You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to ignore some model validations validations for admin user.
Solutions:
I tried https://github.com/stephskardal/rails_admin_import gem where you can assign an attribute in the import hooks: https://github.com/stephskardal/rails_admin_import#import-hooks. However in my Rails 5 the before_import_save cannot be triggered at all when an object gets updated.
I am thinking to use Thread.current to store the user object in controller, then use it in model. But I don't know how i can get the user in the rails_admin. For example, I have a bids controller /bids. Since the admin panel uses another one /admin/panels, so i cannot set a before_action in my bids controller to get current user.
Any suggestion please? Thanks a lot!
The text was updated successfully, but these errors were encountered:
Background
I want to ignore some model validations validations for admin user.
Solutions:
I tried
https://github.com/stephskardal/rails_admin_import
gem where you can assign an attribute in the import hooks: https://github.com/stephskardal/rails_admin_import#import-hooks. However in my Rails 5 thebefore_import_save
cannot be triggered at all when an object gets updated.I am thinking to use
Thread.current
to store the user object in controller, then use it in model. But I don't know how i can get the user in the rails_admin. For example, I have a bids controller/bids
. Since the admin panel uses another one/admin/panels
, so i cannot set abefore_action
in my bids controller to get current user.Any suggestion please? Thanks a lot!
The text was updated successfully, but these errors were encountered: