Module Her::Model::Attributes
In: lib/her/model/attributes.rb

This module handles all methods related to model attributes

Methods

Classes and Modules

Module Her::Model::Attributes::ClassMethods

Public Class methods

Initialize a new object with data

@param [Hash] attributes The attributes to initialize the object with @option attributes [Hash,Array] :_metadata @option attributes [Hash,Array] :_errors @option attributes [Boolean] :_destroyed

@example

  class User
    include Her::Model
  end

  User.new(name: "Tobias")
  # => #<User name="Tobias">

  User.new do |u|
    u.name = "Tobias"
  end
  # => #<User name="Tobias">

Public Instance methods

Return `true` if the other object is also a Her::Model and has matching data

@private

Assign new attributes to a resource

@example

  class User
    include Her::Model
  end

  user = User.find(1) # => #<User id=1 name="Tobias">
  user.assign_attributes(name: "Lindsay")
  user.changes # => { :name => ["Tobias", "Lindsay"] }
attribute(attribute_name)

Alias for get_attribute

Assign attribute value (ActiveModel convention method).

@private

Check attribute value to be present (ActiveModel convention method).

@private

attributes=(new_attributes)

Alias for assign_attributes

Delegate to the == method

@private

Handles returning data for a specific attribute

@private

Handles returning true for the accessible attributes

@private

Delegate to @_her_attributes, allowing models to act correctly in code like:

    [ Model.find(1), Model.find(1) ].uniq # => [ Model.find(1) ]

@private

Return the value of the model `primary_key` attribute

Handles missing methods

@private

[Validate]