Sha256: f416e05c337a367e49809703ac58b3f94d05f3f7a818e49e9e2d1af83ee1c924
Contents?: true
Size: 1016 Bytes
Versions: 1
Compression:
Stored size: 1016 Bytes
Contents
module Authlogic module Session # 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 can take # advantage of the many ActiveRecord tools. module ActiveRecordTrickery def self.included(klass) klass.extend ClassMethods klass.send(:include, InstanceMethods) end module ClassMethods def human_attribute_name(*args) klass.human_attribute_name(*args) end def human_name(*args) klass.human_name(*args) end def self_and_descendents_from_active_record [self] end end module InstanceMethods def new_record? new_session? end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
authlogic-2.0.0 | lib/authlogic/session/active_record_trickery.rb |