module Scorpion::Rails::ActiveRecord::Relation

Make sure that all models return by the relation inherit the relation's scorpion.

Public Instance Methods

spawn() click to toggle source

from ActiveRecord::SpawnMethods

Calls superclass method
# File lib/scorpion/rails/active_record/relation.rb, line 46
def spawn
  sting!( super )
end
with_scorpion( scorpion ) click to toggle source

Elect to use a specific scorpion for all further operations in the chain.

@example

User.all.with_scorpion( scorpion ).where( ... )
User.with_scorpion( scorpion ).where( ... )
# File lib/scorpion/rails/active_record/relation.rb, line 26
def with_scorpion( scorpion )
  spawn.tap do |other|
    other.send :scorpion=, scorpion
  end
end

Private Instance Methods

exec_queries( *args, &block ) click to toggle source

from ActiveRecord::Relation

Calls superclass method
# File lib/scorpion/rails/active_record/relation.rb, line 53
def exec_queries( *args, &block )
  sting!( super )
end
relation_with( *args ) click to toggle source

from ActiveRecord::SpawnMethods

Calls superclass method
# File lib/scorpion/rails/active_record/relation.rb, line 58
def relation_with( *args )
  sting!( super )
end