I've setup two models, 1 and 2, that are associated by has_and_belongs_to_many. I'm trying to get an attribute from model_1 to use in a method in model_2. When I use the code below, I get an error saying 'undefined method model_1_id'. What am I missing? Thanks!
Model_2.rb Class Model_2 < ActiveRecord::Base ... has_and_belongs_to_many :model_1 def some_method attr_a * Model_1.find(model_1_id).attr_I_need end -- 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 rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Pvbh1t-J4qMJ. For more options, visit https://groups.google.com/groups/opt_out.