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/config/base.rb,
lib/rails_admin/config/model.rb,
lib/rails_admin/config/proxy.rb,
lib/rails_admin/i18n_support.rb,
lib/rails_admin/config/fields.rb,
lib/rails_admin/abstract_model.rb,
lib/rails_admin/abstract_object.rb,
lib/rails_admin/config/hideable.rb,
lib/rails_admin/config/sections.rb,
lib/rails_admin/generic_support.rb,
lib/generators/rails_admin/utils.rb,
lib/rails_admin/config/has_fields.rb,
lib/rails_admin/config/has_groups.rb,
lib/rails_admin/config/fields/base.rb,
app/helpers/rails_admin/main_helper.rb,
lib/rails_admin/config/fields/group.rb,
lib/rails_admin/config/fields/types.rb,
app/helpers/rails_admin/form_builder.rb,
lib/rails_admin/config/sections/list.rb,
lib/rails_admin/config/sections/show.rb,
lib/rails_admin/support/csv_converter.rb,
lib/rails_admin/adapters/active_record.rb,
lib/rails_admin/config/sections/create.rb,
lib/rails_admin/config/sections/export.rb,
lib/rails_admin/config/sections/update.rb,
lib/rails_admin/config/fields/groupable.rb,
lib/rails_admin/config/fields/types/date.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/association.rb,
lib/rails_admin/config/fields/types/color.rb,
lib/rails_admin/config/fields/types/float.rb,
app/helpers/rails_admin/application_helper.rb,
lib/rails_admin/config/fields/types/string.rb,
lib/rails_admin/config/sections/navigation.rb,
app/controllers/rails_admin/main_controller.rb,
lib/rails_admin/config/fields/types/boolean.rb,
lib/rails_admin/config/fields/types/decimal.rb,
lib/rails_admin/config/fields/types/integer.rb,
lib/rails_admin/config/fields/types/datetime.rb,
lib/rails_admin/config/fields/types/password.rb,
lib/rails_admin/config/fields/types/dragonfly.rb,
lib/rails_admin/config/fields/types/paperclip.rb,
lib/rails_admin/config/fields/types/timestamp.rb,
app/controllers/rails_admin/history_controller.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,
app/controllers/rails_admin/application_controller.rb,
lib/rails_admin/config/fields/types/has_one_association.rb,
lib/rails_admin/extensions/cancan/authorization_adapter.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
guides.rubyonrails.org/generators.html rdoc.info/github/wycats/thor/master/Thor/Actions.html keep generator idempotent, thanks
Defined Under Namespace
Modules: Adapters, ApplicationHelper, Config, Extensions, Generators, I18nSupport, MainHelper Classes: AbstractModel, AbstractObject, ApplicationController, CSVConverter, Engine, FormBuilder, History, HistoryController, InstallGenerator, MainController, UninstallGenerator
Constant Summary collapse
- VERSION =
FIXME: this needs to be manually kept in sync with the gemspec’s s.version until jira.codehaus.org/browse/JRUBY-5319 is fixed
"0.0.1"
- EXTENSIONS =
[]
- AUTHORIZATION_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
-
.add_extension(extension_key, extension_definition, options = {}) ⇒ Object
Extend RailsAdmin.
- .authenticate_with(&block) ⇒ Object
- .authorize_with(*args, &block) ⇒ Object
-
.config(entity = nil, &block) ⇒ Object
Setup RailsAdmin.
- .configure_with(extension, &block) ⇒ Object
- .current_user_method(&block) ⇒ Object
-
.reset ⇒ Object
Reset RailsAdmin configuration to defaults.
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.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rails_admin/extension.rb', line 10 def self.add_extension(extension_key, extension_definition, = {}) .assert_valid_keys(:authorization, :configuration) EXTENSIONS << extension_key if( = [:authorization]) AUTHORIZATION_ADAPTERS[extension_key] = extension_definition::AuthorizationAdapter end if(configuration = [:configuration]) CONFIGURATION_ADAPTERS[extension_key] = extension_definition::ConfigurationAdapter end end |
.authenticate_with(&block) ⇒ Object
10 11 12 13 |
# File 'lib/rails_admin.rb', line 10 def self.authenticate_with(&block) ActiveSupport::Deprecation.warn("'#{self.name}.authenticate_with { }' is deprecated, use 'RailsAdmin.config{|c| c.authenticate_with }' instead", caller) self.config {|c| c.authenticate_with(&block) } end |
.authorize_with(*args, &block) ⇒ Object
15 16 17 18 |
# File 'lib/rails_admin.rb', line 15 def self.(*args, &block) ActiveSupport::Deprecation.warn("'#{self.name}.authorize_with { }' is deprecated, use 'RailsAdmin.config{|c| c.authorize_with }' instead", caller) self.config {|c| c.(*args, &block) } 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.
43 44 45 46 47 48 49 50 51 |
# File 'lib/rails_admin.rb', line 43 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 |
.configure_with(extension, &block) ⇒ Object
25 26 27 28 |
# File 'lib/rails_admin.rb', line 25 def self.configure_with(extension, &block) ActiveSupport::Deprecation.warn("'#{self.name}.configure_with { }' is deprecated, use 'RailsAdmin.config{|c| c.configure_with }' instead", caller) self.config {|c| c.configure_with(extension, &block) } end |
.current_user_method(&block) ⇒ Object
20 21 22 23 |
# File 'lib/rails_admin.rb', line 20 def self.current_user_method(&block) ActiveSupport::Deprecation.warn("'#{self.name}.current_user_method { }' is deprecated, use 'RailsAdmin.config{|c| c.current_user_method }' instead", caller) self.config {|c| c.current_user_method(&block) } end |
.reset ⇒ Object
Reset RailsAdmin configuration to defaults
54 55 56 |
# File 'lib/rails_admin.rb', line 54 def self.reset RailsAdmin::Config.reset end |