class Locomotive::Steam::Models::EmbeddedAssociation

Note: represents an embedded collection

Public Class Methods

new(repository_klass, collection, scope, options = {}) click to toggle source

use the scope from the parent repository one of the benefits is that if we change the current locale of the parent repository, that will change the local repository as well.

# File lib/locomotive/steam/models/associations/embedded.rb, line 20
def initialize(repository_klass, collection, scope, options = {})
  adapter.collection = collection || []

  @repository = repository_klass.new(adapter)
  @repository.scope = scope

  @options = options
end

Public Instance Methods

__attach__(entity) click to toggle source

In order to keep track of the entity which owns the association.

# File lib/locomotive/steam/models/associations/embedded.rb, line 31
def __attach__(entity)
  name = @options[:mapper_name].to_s.singularize.to_sym
  @repository.send(:"#{name}=", entity)
end
__serialize__(entity) click to toggle source
# File lib/locomotive/steam/models/associations/embedded.rb, line 36
def __serialize__(entity)
  # TODO: not implemented yet
end
method_missing(name, *args, &block) click to toggle source
# File lib/locomotive/steam/models/associations/embedded.rb, line 40
def method_missing(name, *args, &block)
  @repository.send(name, *args, &block)
end
respond_to_missing?(name, include_private = false) click to toggle source
Calls superclass method
# File lib/locomotive/steam/models/associations/embedded.rb, line 44
def respond_to_missing?(name, include_private = false)
  @repository.respond_to?(name) || super
end