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

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -