ruby - undefined method when calling a method in a model of Rails -
i keep getting undefined method when call method model.
class user < activerecord::base def update! request_info end def request_info return "hmmm" end end
request_info inside of update! not defined i've tried making self.request_info doesn't work either
there 2 ways call method in rails.
class foo def self.bar puts 'class method' end def baz puts 'instance method' end end foo.bar # => "class method" foo.baz # => nomethoderror: undefined method ‘baz’ foo:class foo.new.baz # => instance method foo.new.bar # => nomethoderror: undefined method ‘bar’ #<foo:0x1e820>
are doing same? have taken example here. take @ page details.
Comments
Post a Comment