Hi,
I have 3 models:

hotel
has_many :ratings
has_many :categories, :through => :ratings

category
has_many :ratings
has_many :hotels, :through => :ratings

rating
belongs_to :hotel
belongs_to :category

I have categories like food, rooms etc. that I want to rate in my
hotel edit view:
...
<% if @hotel.categories.any? %>
  <% @hotel.ratings.each do |rating| %>
    <% fields_for @hotel.ratings do |rating_form| %>
    <li><% rating.category.name %> <% rating_form.text_field :rating
%></li>
   <% end %>
<% end %>
...

Unfortunately this doesn't work.

Any help would great.

--~--~---------~--~----~------------~-------~--~----~
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