Module: RailsAdmin

Defined in:
lib/generators/rails_admin/install_generator.rb,
lib/rails_admin.rb,
lib/rails_admin/config.rb,
lib/rails_admin/engine.rb,
lib/rails_admin/version.rb,
lib/rails_admin/extension.rb,
lib/rails_admin/i18n_support.rb,
lib/rails_admin/config/model.rb,
lib/rails_admin/config/fields.rb,
lib/rails_admin/config/actions.rb,
lib/rails_admin/abstract_model.rb,
lib/rails_admin/config/sections.rb,
lib/rails_admin/config/hideable.rb,
lib/rails_admin/config/groupable.rb,
lib/rails_admin/config/proxyable.rb,
lib/generators/rails_admin/utils.rb,
lib/rails_admin/adapters/mongoid.rb,
lib/rails_admin/config/has_fields.rb,
lib/rails_admin/config/has_groups.rb,
lib/rails_admin/config/actions/new.rb,
lib/rails_admin/config/fields/base.rb,
app/helpers/rails_admin/main_helper.rb,
lib/rails_admin/config/actions/base.rb,
lib/rails_admin/config/fields/group.rb,
lib/rails_admin/config/actions/edit.rb,
lib/rails_admin/config/fields/types.rb,
lib/rails_admin/config/actions/show.rb,
lib/rails_admin/config/configurable.rb,
lib/rails_admin/config/actions/index.rb,
app/helpers/rails_admin/form_builder.rb,
lib/rails_admin/config/sections/list.rb,
lib/rails_admin/config/sections/base.rb,
lib/rails_admin/config/sections/edit.rb,
lib/rails_admin/config/sections/show.rb,
lib/rails_admin/config/actions/delete.rb,
lib/rails_admin/config/sections/modal.rb,
lib/rails_admin/support/csv_converter.rb,
lib/rails_admin/config/actions/export.rb,
lib/rails_admin/config/proxyable/proxy.rb,
lib/rails_admin/config/sections/export.rb,
lib/rails_admin/adapters/active_record.rb,
lib/rails_admin/config/sections/create.rb,
lib/rails_admin/config/sections/nested.rb,
lib/rails_admin/config/sections/update.rb,
lib/rails_admin/config/fields/types/enum.rb,
lib/rails_admin/config/fields/types/text.rb,
lib/rails_admin/config/fields/types/time.rb,
lib/rails_admin/config/fields/types/date.rb,
lib/rails_admin/config/actions/dashboard.rb,
lib/rails_admin/config/fields/association.rb,
lib/rails_admin/config/fields/types/float.rb,
lib/rails_admin/config/fields/types/color.rb,
app/helpers/rails_admin/application_helper.rb,
lib/rails_admin/config/actions/show_in_app.rb,
lib/rails_admin/config/actions/bulk_delete.rb,
lib/rails_admin/adapters/mongoid/extension.rb,
lib/rails_admin/config/fields/types/hidden.rb,
lib/rails_admin/config/fields/types/string.rb,
lib/rails_admin/config/fields/types/integer.rb,
lib/rails_admin/config/fields/types/boolean.rb,
app/controllers/rails_admin/main_controller.rb,
lib/rails_admin/config/fields/types/decimal.rb,
lib/rails_admin/config/actions/history_show.rb,
lib/rails_admin/config/actions/history_index.rb,
lib/rails_admin/config/fields/types/password.rb,
lib/rails_admin/config/fields/types/datetime.rb,
lib/rails_admin/config/fields/types/paperclip.rb,
lib/rails_admin/config/fields/types/timestamp.rb,
lib/rails_admin/config/fields/types/dragonfly.rb,
lib/rails_admin/config/fields/types/serialized.rb,
lib/generators/rails_admin/uninstall_generator.rb,
lib/rails_admin/config/fields/types/carrierwave.rb,
lib/rails_admin/config/fields/types/file_upload.rb,
lib/rails_admin/adapters/mongoid/abstract_object.rb,
app/controllers/rails_admin/application_controller.rb,
lib/rails_admin/config/fields/types/bson_object_id.rb,
lib/rails_admin/extensions/history/auditing_adapter.rb,
lib/rails_admin/adapters/active_record/abstract_object.rb,
lib/rails_admin/extensions/paper_trail/auditing_adapter.rb,
lib/rails_admin/extensions/cancan/authorization_adapter.rb,
lib/rails_admin/config/fields/types/has_one_association.rb,
lib/rails_admin/config/fields/types/has_many_association.rb,
lib/rails_admin/config/fields/types/belongs_to_association.rb,
lib/rails_admin/config/fields/types/polymorphic_association.rb,
lib/rails_admin/config/fields/types/has_and_belongs_to_many_association.rb

Overview

Defined Under Namespace

Modules: Adapters, ApplicationHelper, Config, Extensions, Generators, I18nSupport, MainHelper Classes: AbstractModel, ApplicationController, CSVConverter, Engine, FormBuilder, History, InstallGenerator, MainController, ModelNotFound, ObjectNotFound, UninstallGenerator, Version

Constant Summary

EXTENSIONS =
[]
AUTHORIZATION_ADAPTERS =
{}
AUDITING_ADAPTERS =
{}
CONFIGURATION_ADAPTERS =
{}
CSVClass =
RUBY_VERSION < '1.9' ? ::FasterCSV : ::CSV
NON_ASCII_ENCODINGS =
/(UTF\-16)|(UTF\-32)|(ISO\-2022\-JP)|(Big5\-HKSCS)|(UTF\-7)/

Class Method Summary collapse

Class Method Details

.add_extension(extension_key, extension_definition, options = {}) ⇒ Object

Extend RailsAdmin

The extension may define various adapters (e.g., for authorization) and register those via the options hash.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/rails_admin/extension.rb', line 12

def self.add_extension(extension_key, extension_definition, options = {})
  options.assert_valid_keys(:authorization, :configuration, :auditing)

  EXTENSIONS << extension_key

  if(authorization = options[:authorization])
    AUTHORIZATION_ADAPTERS[extension_key] = extension_definition::AuthorizationAdapter
  end

  if(configuration = options[:configuration])
    CONFIGURATION_ADAPTERS[extension_key] = extension_definition::ConfigurationAdapter
  end

  if(configuration = options[:auditing])
    AUDITING_ADAPTERS[extension_key] = extension_definition::AuditingAdapter
  end
end

.config(entity = nil, &block) ⇒ Object

Setup RailsAdmin

Given the first argument is a model class, a model class name or an abstract model object proxies to model configuration method.

If only a block is passed it is stored to initializer stack to be evaluated on first request in production mode and on each request in development. If initialization has already occured (in other words RailsAdmin.setup has been called) the block will be added to stack and evaluated at once.

Otherwise returns RailsAdmin::Config class.

See Also:



25
26
27
28
29
30
31
32
33
# File 'lib/rails_admin.rb', line 25

def self.config(entity = nil, &block)
  if entity
    RailsAdmin::Config.model(entity, &block)
  elsif block_given? && ENV['SKIP_RAILS_ADMIN_INITIALIZER'] != "true"
    block.call(RailsAdmin::Config)
  else
    RailsAdmin::Config
  end
end