diff --git a/README.md b/README.md index 78f1dbc9e8..18e6515022 100644 --- a/README.md +++ b/README.md @@ -47,10 +47,6 @@ If you have good reasons to think you found a *rails_admin* bug, submit a ticket API Update Note --------------- -`ActiveRecord::Base.rails_admin` is the new recommendation for configuring -models. The old API is not deprecated as the new one is just a proxy for -`RailsAdmin::Config.model`. - `navigation.max_visible_tabs` is not configurable anymore, as the new Activo theme implements the main navigation as a vertical list. @@ -123,31 +119,10 @@ RailsAdmin provides its out of the box administrative interface by inspecting yo 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. -The configuration code should be placed within model classes, for example: - - app/models/team.rb - - class Team < ActiveRecord::Base - rails_admin do - label "List of teams" - end - end - -Configuration code that is not specific to any model, such as options listed in -the following General section and later in Mass Assignment Operations, should -be placed in an initializer file, for example: +The configuration code should be placed in an initializer file, for example: config/initializers/rails_admin.rb - RailsAdmin.config do |config| - config.models do - list do - fields_of_type :datetime do - date_format :compact - end - end - end - end ### General @@ -192,8 +167,8 @@ sure that new models are not automatically added to RailsAdmin, e.g. because of If you need to customize the label of the model, use: - class Team < ActiveRecord::Base - rails_admin do + RailsAdmin.config do |config| + config.model Team do label "List of teams" end end @@ -219,13 +194,15 @@ related models and for part of the audit information stored in the history records--so keep in mind that this configuration option has widespread effects. - class Team < ActiveRecord::Base - rails_admin do + RailsAdmin.config do |config| + config.model Team do object_label_method do :custom_label_method end end + end + def Team