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

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -