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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -