(D. Alvarado)
8/4/2008 8:54:00 PM
Hi,
Yesterday the group was kind enough to explain distinctions between
class and instance methods, but I guess I still missed something b/c
I'm getting an error. I have this method in my EcOrder model ...
class EcOrder < ActiveRecord::Base
has_many :ec_line_items
validates_associated :ec_line_items
...
def has_item=(form_item_id)
for ec_line_item in this.ec_line_items
if ec_line_item.form_item_id == form_item_id
true
return
end
end
false
end
end
I intended to create an instance method. But then, in a view, when I
call
<%= check_box_tag('form[form_items][]', form_item.id,
@ec_order.has_item(form_item.id)) %>
I get the error, "undefined method `has_item' for #<EcOrder:
0xb788e264>".
Sorry to make you guys repeat yourselves, but I think I'm really
close, - Dave