On 4 September 2012 18:58, Sachin S. <[email protected]> wrote: > Class Model_1 < ActiveRecord::Base > ... > has_and_belongs_to_many :model_2 > > def some_method > attr_1 * Model_2.find(model_2_id).attr_I_need > end
If the relationship is HABTM, you won't have a model_2_id attribute to find by, there should be a join table. If you explain in a little more detail what problem you're trying to solve with your relationship and the mathematical operation between them, maybe a solution can be suggested. -- 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 https://groups.google.com/groups/opt_out.

