Sha256: f3c0ec65d6db302ffac658945f02fb7814ff5bd502f81832090e2aef0f25f9e4

Contents?: true

Size: 844 Bytes

Versions: 4

Compression:

Stored size: 844 Bytes

Contents

module Authgasm
  module Session
    # = ActiveRecord Trickery
    #
    # Authgasm 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 Authgasm.
    module ActiveRecordTrickery
      def self.included(klass) # :nodoc:
        klass.extend ClassMethods
        klass.send(:include, InstanceMethods)
      end
      
      module ClassMethods # :nodoc:
        def human_attribute_name(attribute_key_name, options = {})
          attribute_key_name.humanize
        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
authgasm-0.10.0 lib/authgasm/session/active_record_trickery.rb
authgasm-0.10.1 lib/authgasm/session/active_record_trickery.rb
authgasm-0.10.2 lib/authgasm/session/active_record_trickery.rb
authgasm-0.10.3 lib/authgasm/session/active_record_trickery.rb