On 30 Nov 2008, at 20:07, John Doe wrote:

>
> Frederick Cheung wrote:
>
>>>
>> The obvious answer would be that you have a dilemma side with no side
>> images.
>>
>> Fred
>
> Hi Fred,
>
> Thank you, but as you can see above, the output of the debug command
> above, side_image does contain a Side Image:
>
Are you sure that's not displaying the side image from a previous  
iteration through the loop ?

How about you change your code to

<% @dilemmas.each do |dilemma| %>
    <% dilemma.dilemma_sides.each do |dilemma_side| %>

      <% side_image = dilemma_side.side_images.first %>
      <% if !side_image %>
        Side <%= dilemma_side.id %> has no images
      <% end %>
    <%end%>
<% end %>

and see what it outputs.

Fred

> --- !ruby/object:SideImage
> attributes:
>  content_type: image/jpeg
>  size: "44882"
>  thumbnail:
>  updated_at: 2008-11-28 19:06:35
>  id: "1"
>  dilemma_side_id: "1"
>  height: "256"
>  filename: IMG_0026.JPG
>  parent_id:
>  width: "341"
>  created_at: 2008-11-28 19:06:35
> attributes_cache: {}
>
>
> I'm just not able to access the attributes!
>
> Cheers,
> John
> -- 
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to