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
Post a Comment