Sha256: 68cbb1baee1bb3c62a33aae253505a3d8d65accb1b913aa87bd810e677c3900c
Contents?: true
Size: 862 Bytes
Versions: 6
Compression:
Stored size: 862 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, or any # method that expects an ActiveRecord object. The point is to disguise the object as an ActiveRecord object so we have no problems. 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
6 entries across 6 versions & 1 rubygems