Sha256: ad81298dbc8b129ab46e0c9493c8abc52b8bdf283646917921289bb4d2853457

Contents?: true

Size: 826 Bytes

Versions: 4

Compression:

Stored size: 826 Bytes

Contents

module Authlogic
  module Session
    # = ActiveRecord Trickery
    #
    # Authlogic looks like ActiveRecord, sounds like ActiveRecord, but its not ActiveRecord. That's the goal here. This is useful for the various rails helper methods such as form_for, error_messages_for, etc.
    # These helpers exptect various methods to be present. This adds in those methods into Authlogic.
    module ActiveRecordTrickery
      def self.included(klass) # :nodoc:
        klass.extend ClassMethods
        klass.send(:include, InstanceMethods)
      end
      
      module ClassMethods # :nodoc:
        def human_attribute_name(*args)
          klass.human_attribute_name(*args)
        end
      end
      
      module InstanceMethods # :nodoc:
        def new_record?
          new_session?
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
authlogic-1.3.5 lib/authlogic/session/active_record_trickery.rb
authlogic-1.3.6 lib/authlogic/session/active_record_trickery.rb
authlogic-1.3.4 lib/authlogic/session/active_record_trickery.rb
authlogic-1.3.7 lib/authlogic/session/active_record_trickery.rb