ruby on rails 4 - custom instance variable name in cancan's load_and_authorize_resource? -
users_controller.rb
class userscontroller < applicationcontroller def index @objects = user.filter(params: params) end end
q.1 > if 'load_and_authorize_resource' called instance variable load ?
q.2 > if loads @user or @users how make load on @object ?
i think i'm lacking sufficient knowledge understanding cancan (i'm rails newbie) , using since last 4 days, hoping question makes sense.
a resource not loaded if instance variable set. makes easy override behavior through before_filter on actions - cancan https://github.com/ryanb/cancan/blob/master/lib/cancan/controller_additions.rb line 34 , 35, can in controller --
before_filter :set_instance_variable load_and_authorize_resource private def set_instance_variable @object = "blah blah blah" end
load_and_authorize_resource should called after setting instance variable i.e. after 'before_filter :set_instance_variable'
Comments
Post a Comment