Reputation: 703
I want to display something before a particular page loading.(Like a flash message after checking some condition). I am using active admin. How can i do this?
ActiveAdmin.register User do
config.batch_actions = false
config.paginate = false
menu false
actions :index, :destroy, :show
index do
column 'ID', :id
column :name
column :short_name
column :start_date
column :end_date
column :aggregatable
column :branch do |user|
link_to user.branch.name, active_user_branch_path(id: user.branch_id)
end
column :lock_status
default_actions( name: 'Actions' )
end
end
Upvotes: 2
Views: 1599
Reputation: 52357
Answering the question regarding how to set before filter in ActiveAdmin: before filter should be set in controller.
Pattern:
controller do
before_filter :my_filter, only: %i(index)
private
def my_filter
#logic here
end
end
Upvotes: 1