-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Base configuration
Ken Liu edited this page Apr 2, 2014
·
39 revisions
RailsAdmin provides its out of the box administrative interface by inspecting your application's models and following some Rails conventions. For a more tailored experience, it also provides a configuration DSL which allows you to customize many aspects of the interface.
Set the application name:
RailsAdmin.config do |config|
config.main_app_name = ["Cool app", "BackOffice"]
# or somethig more dynamic
config.main_app_name = Proc.new { |controller| [ "Cool app", "BackOffice - #{controller.params[:action].try(:titleize)}" ] }
end
Locale
If your default_local is different from :en, set your default locale at the beginning of the file:
require 'i18n'
I18n.default_locale = :de
Authentication integration (Devise, Sorcery, Manual)
Authorization (Cancan)
ActiveModel's :attr_accessible :attr_protected
Default is :default (default for ActiveModel)
config.attr_accessible_role { :default }
_current_user
is accessible in the block if you need to make it user specific:
config.attr_accessible_role { _current_user.role.to_sym }
Instance labels
config.label_methods << :description # Default is [:name, :title]
Next
Then you can start adding actions, configuring models, sections and fields.