class DatastaxRails::Associations::AssociationScope
Creates the scope (relation) for the assocation
Attributes
association[R]
Public Class Methods
new(association)
click to toggle source
# File lib/datastax_rails/associations/association_scope.rb, line 10 def initialize(association) @association = association end
Public Instance Methods
scope()
click to toggle source
# File lib/datastax_rails/associations/association_scope.rb, line 14 def scope scope = klass.unscoped scope = scope.extending(*Array.wrap(options[:extend])) if reflection.source_macro == :belongs_to scope.where('id' => owner.send(reflection.foreign_key)) else scope.where(reflection.foreign_key => owner.id) end end