Jette Chan wrote: > Now I have 3 models, item category and sub-category > and 3 Tables in my database. > > I planed to set the association like this. > > Item > Belongs_to :category > Belongs_to :sub-category > > category > Has_many :items > Has_many :sub_category > > sub_category > belongs_to :category > Has_many :items > > And now I want to have some dynamic drop down list in the items/new > page > When I chose one category, and the sub-category will dynamically > updated. > what other move do I need? > > Is that right? It makes me feel confused with these associations.
category.rb has_many :sub_categories has_many :items ,:through=>:sub_categories sub_category.rb belongs_to :category has_many :items item.rb belongs_to :sub_category by use of this association you can define get any of 2 by select of any of 1 among three models for that use Ajax Updater -- 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 -~----------~----~----~----~------~----~------~--~---

