Sha256: 9d3b4d8b822ad376b6f3579a0d3c7792c66247d516410a82dd0b408917f5e32b
Contents?: true
Size: 568 Bytes
Versions: 5
Compression:
Stored size: 568 Bytes
Contents
module Slaver class ScopeProxy attr_reader :klass, :config_name def initialize(klass, config_name) @klass = klass @config_name = config_name end def on(config_name) @config_name = config_name self end def method_missing(method, *args, &block) result = self ::ActiveRecord::Base.within(config_name) do result = klass.send(method, *args, &block) if result.is_a?(ActiveRecord::Relation) @klass = result return self end end result end end end
Version data entries
5 entries across 5 versions & 1 rubygems