Sha256: ff4c095e37dd17a41d55d055741b8b07e2722056829ade3ca9fcc3eb4886029a

Contents?: true

Size: 1.87 KB

Versions: 11

Compression:

Stored size: 1.87 KB

Contents

require 'rails_admin/engine'
require 'rails_admin/abstract_model'
require 'rails_admin/config'
require 'rails_admin/extension'
require 'rails_admin/extensions/cancan'
require 'rails_admin/extensions/cancancan'
require 'rails_admin/extensions/pundit'
require 'rails_admin/extensions/paper_trail'
require 'rails_admin/extensions/history'
require 'rails_admin/support/csv_converter'
require 'rails_admin/support/hash_helper'
require 'yaml'

module RailsAdmin
  # 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 RailsAdmin::Config
  def self.config(entity = nil, &block)
    if entity
      RailsAdmin::Config.model(entity, &block)
    elsif block_given?
      block.call(RailsAdmin::Config)
    else
      RailsAdmin::Config
    end
  end

  # Backwards-compatible with safe_yaml/load when SafeYAML isn't available.
  # Evaluates available YAML loaders at boot and creates appropriate method,
  # so no conditionals are required at runtime.
  begin
    require 'safe_yaml/load'
    def self.yaml_load(yaml)
      SafeYAML.load(yaml)
    end
  rescue LoadError
    if YAML.respond_to?(:safe_load)
      def self.yaml_load(yaml)
        YAML.safe_load(yaml)
      end
    else
      raise LoadError.new "Safe-loading of YAML is not available. Please install 'safe_yaml' or install Psych 2.0+"
    end
  end

  def self.yaml_dump(object)
    YAML.dump(object)
  end
end

require 'rails_admin/bootstrap-sass' unless defined? Bootstrap

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rails_admin-1.4.3 lib/rails_admin.rb
rails_admin-2.0.0.beta lib/rails_admin.rb
rails_admin-1.4.2 lib/rails_admin.rb
rails_admin-1.4.1 lib/rails_admin.rb
rails_admin-1.4.0 lib/rails_admin.rb
rails_admin-1.3.0 lib/rails_admin.rb
rails_admin-1.2.0 lib/rails_admin.rb
rails_admin-1.1.1 lib/rails_admin.rb
rails_admin-1.1.0 lib/rails_admin.rb
rails_admin-1.0.0 lib/rails_admin.rb
rails_admin-1.0.0.rc lib/rails_admin.rb