lib/her/model/paths.rb
# Define the primary key field that will be used to find and save records
#
# @example
#  class User
#    include Her::Model
#    primary_key 'UserId'
#  end
#
# @param [Symbol] value
Define the primary key field that will be used to find and save records
Define the primary key field that will be used to find and save records
def primary_key(value = nil)
          @_her_primary_key ||= begin
            superclass.primary_key if superclass.respond_to?(:primary_key)
          end
          return @_her_primary_key unless value
          @_her_primary_key = value.to_sym
        end
def primary_key ( value = nil ) @_her_primary_key ||= begin superclass . primary_key if superclass . respond_to? ( :primary_key ) end return @_her_primary_key unless value @_her_primary_key = value . to_sym end
Define the primary key field that will be used to find and save records
Define the primary key field that will be used to find and save records
value
<not_specific>
<not_specific>
None
example
class User include Her::Model primary_key 'UserId' end
class User include Her :: Model primary_key ' UserId ' end