Sha256: 8e6762e32a86784669bc9d2b9e23e691ea451768f0b0028821ed421de81f6b69

Contents?: true

Size: 1.19 KB

Versions: 1

Compression:

Stored size: 1.19 KB

Contents

module Restly::Associations::Base::Modifiers

  # Modifiers
  def authorize(authorization = nil, association_class=self.association_class)
    duplicate = self.dup
    duplicate.instance_variable_set :@association_class, if (!association_class.authorized? && @owner.respond_to?(:authorized?) && @owner.authorized?) || authorization
                                                           association_class.authorize(authorization || @owner.connection)
                                                         else
                                                           association_class
                                                         end
    duplicate
  end

  def with_path(parent, path = nil, association_class=self.association_class)
    duplicate = self.dup
    duplicate.instance_variable_set :@association_class, if path
                                                           association_class.with_path(path)
                                                         else
                                                           association_class.with_path(association_resource_name, prepend: parent.path)
                                                         end
    duplicate
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restly-0.0.1.alpha.6 lib/restly/associations/base/modifiers.rb