123456789_123456789_123456789_123456789_123456789_

Module: ActiveModel

Relationships & Source Files
Namespace Children
Modules:
Classes:
Exceptions:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: activemodel/lib/active_model.rb,
activemodel/lib/active_model/access.rb,
activemodel/lib/active_model/api.rb,
activemodel/lib/active_model/attribute.rb,
activemodel/lib/active_model/attribute_assignment.rb,
activemodel/lib/active_model/attribute_methods.rb,
activemodel/lib/active_model/attribute_mutation_tracker.rb,
activemodel/lib/active_model/attribute_registration.rb,
activemodel/lib/active_model/attribute_set.rb,
activemodel/lib/active_model/attributes.rb,
activemodel/lib/active_model/callbacks.rb,
activemodel/lib/active_model/conversion.rb,
activemodel/lib/active_model/deprecator.rb,
activemodel/lib/active_model/dirty.rb,
activemodel/lib/active_model/error.rb,
activemodel/lib/active_model/errors.rb,
activemodel/lib/active_model/forbidden_attributes_protection.rb,
activemodel/lib/active_model/gem_version.rb,
activemodel/lib/active_model/lint.rb,
activemodel/lib/active_model/model.rb,
activemodel/lib/active_model/naming.rb,
activemodel/lib/active_model/nested_error.rb,
activemodel/lib/active_model/railtie.rb,
activemodel/lib/active_model/secure_password.rb,
activemodel/lib/active_model/serialization.rb,
activemodel/lib/active_model/translation.rb,
activemodel/lib/active_model/type.rb,
activemodel/lib/active_model/validations.rb,
activemodel/lib/active_model/validator.rb,
activemodel/lib/active_model/version.rb,
activemodel/lib/active_model/attribute/user_provided_default.rb,
activemodel/lib/active_model/attribute_set/builder.rb,
activemodel/lib/active_model/attribute_set/yaml_encoder.rb,
activemodel/lib/active_model/serializers/json.rb,
activemodel/lib/active_model/type/big_integer.rb,
activemodel/lib/active_model/type/binary.rb,
activemodel/lib/active_model/type/boolean.rb,
activemodel/lib/active_model/type/date.rb,
activemodel/lib/active_model/type/date_time.rb,
activemodel/lib/active_model/type/decimal.rb,
activemodel/lib/active_model/type/float.rb,
activemodel/lib/active_model/type/immutable_string.rb,
activemodel/lib/active_model/type/integer.rb,
activemodel/lib/active_model/type/registry.rb,
activemodel/lib/active_model/type/serialize_cast_value.rb,
activemodel/lib/active_model/type/string.rb,
activemodel/lib/active_model/type/time.rb,
activemodel/lib/active_model/type/value.rb,
activemodel/lib/active_model/type/helpers/accepts_multiparameter_time.rb,
activemodel/lib/active_model/type/helpers/mutable.rb,
activemodel/lib/active_model/type/helpers/numeric.rb,
activemodel/lib/active_model/type/helpers/time_value.rb,
activemodel/lib/active_model/type/helpers/timezone.rb,
activemodel/lib/active_model/validations/absence.rb,
activemodel/lib/active_model/validations/acceptance.rb,
activemodel/lib/active_model/validations/callbacks.rb,
activemodel/lib/active_model/validations/clusivity.rb,
activemodel/lib/active_model/validations/comparability.rb,
activemodel/lib/active_model/validations/comparison.rb,
activemodel/lib/active_model/validations/confirmation.rb,
activemodel/lib/active_model/validations/exclusion.rb,
activemodel/lib/active_model/validations/format.rb,
activemodel/lib/active_model/validations/helper_methods.rb,
activemodel/lib/active_model/validations/inclusion.rb,
activemodel/lib/active_model/validations/length.rb,
activemodel/lib/active_model/validations/numericality.rb,
activemodel/lib/active_model/validations/presence.rb,
activemodel/lib/active_model/validations/resolve_value.rb,
activemodel/lib/active_model/validations/validates.rb,
activemodel/lib/active_model/validations/with.rb

Overview

Class Method Summary

::ActiveSupport::Autoload - Extended

Instance Method Summary

  • #slice(*methods)

    Returns a hash of the given methods with their names as keys and returned values as values.

  • #values_at(*methods)

    Returns an array of the values returned by the given methods.

Class Method Details

.deprecator

This method is for internal use only.
[ GitHub ]

  
# File 'activemodel/lib/active_model/deprecator.rb', line 4

def self.deprecator # :nodoc:
  @deprecator ||= ActiveSupport::Deprecation.new
end

.eager_load!

[ GitHub ]

  
# File 'activemodel/lib/active_model.rb', line 76

def self.eager_load!
  super
  ActiveModel::Serializers.eager_load!
end

.gem_version

Returns the currently loaded version of Active Model as a Gem::Version.

[ GitHub ]

  
# File 'activemodel/lib/active_model/gem_version.rb', line 5

def self.gem_version
  Gem::Version.new VERSION::STRING
end

.version

Returns the currently loaded version of Active Model as a Gem::Version.

[ GitHub ]

  
# File 'activemodel/lib/active_model/version.rb', line 7

def self.version
  gem_version
end

Instance Method Details

#slice(*methods)

Returns a hash of the given methods with their names as keys and returned values as values.

person = Person.new(id: 1, name: "bob")
person.slice(:id, :name)
#=> { "id" => 1, "name" => "bob" }
[ GitHub ]

  
# File 'activemodel/lib/active_model/model.rb', line 48

rdoc_method :method: slice

#values_at(*methods)

Returns an array of the values returned by the given methods.

person = Person.new(id: 1, name: "bob")
person.values_at(:id, :name)
#=> [1, "bob"]
[ GitHub ]

  
# File 'activemodel/lib/active_model/model.rb', line 63

rdoc_method :method: values_at