--
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 rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/UST5imVYvwMJ.
For more options, visit https://groups.google.com/groups/opt_out.
No man ...i just use HABM in models and when i fire command in console at that point third table is created.And i do nothing manually..
The simplest rule of thumb is that you should set up a has_many :through relationship if you need to work with the relationship model as an independent entity. If you don’t need to do anything with the relationship model, it may be simpler to set up a has_and_belongs_to_many relationship (though you’ll need to remember to create the joining table in the database).
You should use has_many :through if you need validations, callbacks, or extra attributes on the join model.
On Friday, September 21, 2012 3:51:41 PM UTC+5:30, Fahim Patel wrote:I have two models cow and milkman.I am using has_and_belongs_to_many in both models .By mistake i have deleted cows_milkmans table from database.When i use this command i am getting errora = Cow.lasta.milkmans # when i fire this command then i am getting error that cows_milkmans table not existAs per my knowledge has_and_belongs_to_many will create third table automatically , no migration is needed.
How can get that table ?
--
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 rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/tPh97NyF83oJ.