Tag: Rails Admin

Rails Admin: Conditionally display a field based on a specific object’s value

To conditionally display a field based on a value in the displayed object, you can do the following: RailsAdmin.config do |config| config.model YourObject do edit do field :some_random_attribute do visible do bindings[:object].your_conditional_field==”your_conditional_value” end end end end end   In this Rails Admin configuration example, you can see that the YourObject#some_random_attribute field will only display if […]

Rails Admin Custom Dashboard

To create a custom rails_admin dashboard, first create a new file here: lib/rails_admin.rb   And in your rails_config/initializers/rails_admin.rb initializer file, be sure to include the above file: RailsAdmin.config do |config| require Rails.root.join(‘lib’, ‘rails_admin.rb’) end   Within this new file, do the following: module RailsAdmin module Config module Actions class Dashboard < RailsAdmin::Config::Actions::Base RailsAdmin::Config::Actions.register(self) register_instance_option :root? […]