activeadmin - Get type of user modifying record - Rails -
i have in model:
attr_accessible :name, as: :admin
and in active admin initializer:
module activeadmin class basecontroller with_role :admin end end
is possible role editing record in model, this:
validate :thing, if: ->{ modifier == :admin }
?
i used attr_accessor
now:
class service attr_accessor :modifier attr_accessible ..., :modifier, as: :admin
and send form:
activeadmin.register service form |f| f.input :modifier, as: :hidden, input_html: { value: :admin } ...
then use this:
validate :something def if modifier == 'admin' # code here
Comments
Post a Comment