Sha256: 1393500f079b7cb905c29d24a84149f3d6888f175b1afa7cd8ac08be962be754

Contents?: true

Size: 490 Bytes

Versions: 4

Compression:

Stored size: 490 Bytes

Contents

# frozen_string_literal: true

ActiveSupport.on_load(:active_record) do
  module ActiveRecord
    class Base
      def self.rails_admin(&block)
        RailsAdmin.config(self, &block)
      end

      def rails_admin_default_object_label_method
        new_record? ? "new #{self.class}" : "#{self.class} ##{id}"
      end

      def safe_send(value)
        if has_attribute?(value)
          read_attribute(value)
        else
          send(value)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_admin-3.3.0 config/initializers/active_record_extensions.rb
rails_admin-3.2.1 config/initializers/active_record_extensions.rb
rails_admin-3.2.0 config/initializers/active_record_extensions.rb
rails_admin-3.2.0.rc config/initializers/active_record_extensions.rb