Module: ActiveModel
Overview
Class Method Summary
- .eager_load!
-
.gem_version
Returns the currently loaded version of Active Model as a
Gem::Version
. -
.version
Returns the currently loaded version of Active Model as a
Gem::Version
.
::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
.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
.
.version
Returns the currently loaded version of Active Model as a Gem::Version
.
# 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" }
# 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"]
# File 'activemodel/lib/active_model/model.rb', line 63
rdoc_method :method: values_at