> Have you got a new line before the { ? It must all be on one line so
> that ruby knows the { is the start of a block for the group_by call.
> So the following all on one line:
>
> <% @appointments.group_by { |appointment|
> appointment.start.strftime("%Y-%m-%d") }.each_pair do |start_date,
> appointments| %>
It's now all in one line
--------------------------------------------------
<% @appointments.group_by { |appointment|
appointment.start.strftime("%Y-%d-%d") }.each_pair do |start_date,
appointments| %>
<tr class="<%= cycle('list_line_odd', 'list_line_even') %>">
<td><%= appointment.client.name %></td>
<td><%= appointment.service.name %></td>
<td><%= appointment.start.strftime("%A %b %d %Y at %I:%M %p")
%></td>
<td><%= link_to 'Show', appointment %></td>
<td><%= link_to 'Edit', edit_appointment_path(appointment) %></td>
<td><%= link_to 'Destroy', appointment, :confirm => 'Are you sure?',
:method => :delete %></td>
</tr>
<% end %>
------------------------------------------------
ERROR
------------------------------------------------
undefined local variable or method `appointment' for
#<#<Class:0x104c62280>:0x104c60520>
Extracted source (around line #16):
13: <% @appointments.group_by { |appointment|
appointment.start.strftime("%Y-%d-%d") }.each_pair do |start_date,
appointments| %>
14:
15: <tr class="<%= cycle('list_line_odd', 'list_line_even') %>">
16: <td><%= appointment.client.name %></td>
17: <td><%= appointment.service.name %></td>
18: <td><%= appointment.start.strftime("%A %b %d %Y at %I:%M %p")
%></td>
19: <td><%= link_to 'Show', appointment %></td>
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.