app/models/admin_action.rb in rails_base-0.61.0 vs app/models/admin_action.rb in rails_base-0.70.0
- old
+ new
@@ -18,17 +18,18 @@
DEFAULT_PAGE_RANGE = 2
class << self
include ActionView::Helpers::DateHelper
+
def action(admin_user:, action:, user: nil, original_attribute: nil, new_attribute: nil, long_action: nil)
params = { admin_user_id: admin_user.id, action: action }
params[:user_id] = user.id if user
params[:change_from] = original_attribute.to_s unless original_attribute.nil?
params[:change_to] = new_attribute.to_s unless new_attribute.nil?
params[:long_action] = long_action unless long_action.nil?
begin
- instance = AdminAction.create!(params)
+ instance = AdminAction.create!(**params)
ship_to_cache!(instance: instance, user: user, created_at: Time.zone.now) if user
instance
rescue StandardError => e
Rails.logger.error(e.message)
Rails.logger.error("Unable to save admin action [#{action}]: [#{params}]")