module Arsi::Relation
Attributes
without_arsi[W]
Public Class Methods
prepended(base)
click to toggle source
# File lib/arsi/relation.rb, line 25 def self.prepended(base) base.class_eval do alias_method :update_all_without_arsi, :update_all def update_all(*args) with_relation_in_connection { update_all_without_arsi(*args) } end end end
Public Instance Methods
delete_all(*)
click to toggle source
Calls superclass method
# File lib/arsi/relation.rb, line 21 def delete_all(*) with_relation_in_connection { super } end
update_all(*args)
click to toggle source
# File lib/arsi/relation.rb, line 28 def update_all(*args) with_relation_in_connection { update_all_without_arsi(*args) } end
without_arsi()
click to toggle source
# File lib/arsi/relation.rb, line 5 def without_arsi if block_given? raise "Use without_arsi in a chain. Don't pass it a block" end dup.tap(&:without_arsi!) end
without_arsi!()
click to toggle source
# File lib/arsi/relation.rb, line 12 def without_arsi! @without_arsi = true end
without_arsi?()
click to toggle source
# File lib/arsi/relation.rb, line 16 def without_arsi? return @without_arsi if defined?(@without_arsi) && @without_arsi !arsi_scopeable? end
Private Instance Methods
arsi_scopeable?()
click to toggle source
# File lib/arsi/relation.rb, line 36 def arsi_scopeable? @klass.columns.any? { |c| c.name =~ Arsi::SCOPEABLE_REGEX } end
with_relation_in_connection() { || ... }
click to toggle source
# File lib/arsi/relation.rb, line 40 def with_relation_in_connection @klass.connection.arsi_relation = self yield ensure @klass.connection.arsi_relation = nil end