Sha256: 450a24030cc3264111bf5b99f7cfb09c9ea703431a17ccb92e5733aa3890bcbb

Contents?: true

Size: 836 Bytes

Versions: 1

Compression:

Stored size: 836 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?
          true
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
authgasm-0.9.1 lib/authgasm/session/active_record_trickery.rb