On Tue, Sep 4, 2012 at 9:53 AM, sacshu wrote:
> When I use the code below, I get an error saying
> 'undefined method model_1_id'. What am I missing? Thanks!
> Class Model_2 < ActiveRecord::Base
> ...
> has_and_belongs_to_many :model_1
>
> def some_method
>attr_a * Model_1.find(model_1_id).at
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 < Activ
2 matches
Mail list logo