Sha256: 05dc3b6247d9cce1844f9a53e157ace4a17b140bc65f9791ee608767cfe6a3a4
Contents?: true
Size: 448 Bytes
Versions: 13
Compression:
Stored size: 448 Bytes
Contents
module NinjaModel module Identity extend ActiveSupport::Concern included do class_attribute :primary_key self.primary_key = :id undef_method(:id) if method_defined?(:id) end def to_model self end def to_param send(self.class.primary_key).to_s if persisted? end def to_key key = nil key = send(self.class.primary_key) if persisted? [key] if key end end end
Version data entries
13 entries across 13 versions & 1 rubygems