On Oct 13, 6:54 pm, Paul Young <[EMAIL PROTECTED]>
wrote:
> Hi I have been following this discussion and I have added a
> brand_id:integer field to my items table. The create button now works
> and populates the brand column with a number.
>
> I've added this to the item show view:
>
> <% for brand in Brand.find(:all, :conditions => {:id => @item.id}) %>
> <div>
> <%= brand.name %>
> </div>
> <% end %>
>
> However some of the brand names are not the name I selected when I
> created the entry.
is this suppose to show the brands for a particular item? The above
can't do that - you're selecting brands whose id matches the items id,
the results will be unpredictable at best. @item.brand contains the
brand you selected for the item.
Fred
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---