Prev | Current Page 128 | Next

David Berube

"Practical Reporting with Ruby and Rails"

length > 0 %>
actor_today[:bookings].each do |b|
<%=b.booked_at.strftime('%I:%m%p') %>,
<%=b.room.name %>,
<%=b.project.name %>

<%end%>
<%else%>
Nothing for today!
<%end%>


<% end %>

Tomorrow's Schedule:


<% @actors_tomorrow.each do |actor_tomorrow| %>

<%= actor_tomorrow[:actor].name %>


<%if actor_tomorrow[:bookings].length > 0 %>
actor_tomorrow [:bookings].each do |b|
<%=b.booked_at.strftime('%I:%m%p') %>,
<%=b.room.name %>,
<%=b.project.name %>

<%end%>
<%else%>
Nothing for tomorrow!
<%end%>
<% end %>
Save this file as app/views/home/index.rhtml.
Now you need just one more piece: a layout, which is used as a template. In other
words, the view is displayed inside the layout. Listing 5-8 shows the layout.
CHAPTER 5 n CONNECTING YOUR REPORTS TO THE WORLD 86
Listing 5-8. Layout for the Actor Schedule View (app/views/layouts/application.rhtml)


Actor Schedule Report


<%= yield %>


Save this as app/views/layouts/application.


Pages:
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140

Lokaty jednodniowe domy wczasowe naprawa komputerów Warszawa transport odpadów ochrona mienia