Sha256: c68591de3b57f35ea39ef60f19645a9314ae5becbb6dce591ba428871fa94d76

Contents?: true

Size: 689 Bytes

Versions: 2

Compression:

Stored size: 689 Bytes

Contents

module Authlogic
  module ActiveRecord
    class ScopedSession # :nodoc:
      attr_accessor :klass, :find_options, :id
      
      def initialize(klass, find_options, id)
        self.klass = klass
        self.find_options = find_options
        self.id = id
      end
      
      [:create, :create!, :find, :new].each do |method|
        class_eval <<-"end_eval", __FILE__, __LINE__
          def #{method}(*args)
            klass.with_scope(scope_options) do
              klass.#{method}(*args)
            end
          end
        end_eval
      end
      
      private
        def scope_options
          {:find_options => find_options, :id => id}
        end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authlogic-0.10.4 lib/authlogic/active_record/scoped_session.rb
authlogic-1.0.0 lib/authlogic/active_record/scoped_session.rb