ruby on rails - Rails_admin, Assigning Devise's current_user to model inside action -


i have devise model person log in , manage rails_admin app.

i have model called model has updater added mongoid-history.

in order set updated story need this:

model = model.new model.updater = person.first model.save 

according link github, can not set current_person, created devise automatically. that's means need set updater manually each time when happens model.

how current_person , set model rails_admin's action happens?

i know need write each action in initializers/rails_admin.rb

there's no access current_user model, because activerecord models can used independently rails apps, can used without logging in.

it controller (often) requires user login , has access user session , current_user method. controller must therefore work of setting updater on model.

perhaps set callback method in controller acts on action modifies model , sets updater there.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -