L
laredotornado
Hi,
I have a model, in which I have defined a method ...
class Form < ActiveRecord::Base
has_many :form_items
validates_associated :form_items
....
def self.has_items
FormItem.countall, :conditions => ["form_id
= ?", :id])
end
end
but when i try and call this method from another class,
def new
@form = Form.find_by_user_id(session[:user_id])
if (@form == nil)
false
else
@form.has_items
end
end
I'm getting the error below:
undefined method `has_items' for #<Form:0xb78f5e3c>
Any ideas? Thanks, - Dave
I have a model, in which I have defined a method ...
class Form < ActiveRecord::Base
has_many :form_items
validates_associated :form_items
....
def self.has_items
FormItem.countall, :conditions => ["form_id
= ?", :id])
end
end
but when i try and call this method from another class,
def new
@form = Form.find_by_user_id(session[:user_id])
if (@form == nil)
false
else
@form.has_items
end
end
I'm getting the error below:
undefined method `has_items' for #<Form:0xb78f5e3c>
Any ideas? Thanks, - Dave