>
> 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>
>
Now, I'm definitely not very good with Ruby, let alone Rails, so this
is just guesstimation. Take it as you will.
The error looks correct, as in the 'appointment' variable is out of
scope where you're using it.
IIRC, the scope ends at the closing bracket to the block, so when you
call .each_pair, 'appointment'
is gone.
Do you wanting to do something with each of the elements in @appointments ?
-J
--
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.