ruby on rails - ApplicationController Method with Equal Sign -


in rails 4 i'm trying this:

class applicationcontroller < actioncontroller::base   # not work   def x=(value)     session[:x] = value   end    # have instead   def set_x(value)     session[:x] = value   end   end 

when try call x = 1 child controller, don't error, session variable doesn't set. running set_x 1 works expected though.

i think problem of scope, instead of calling x = 1, try call self.x = 1.


Comments

Popular posts from this blog

c# - Sort XmlNodeList with a specific Node value -

Android Java.Lang.RuntimeException : Unable to start activity Component Info -

actionscript 3 - Equivalent to moveReceived in ElectroServer 5 -