Module: Superstore::AttributeMethods::PrimaryKey

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/superstore/attribute_methods/primary_key.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#attributesObject



21
22
23
# File 'lib/superstore/attribute_methods/primary_key.rb', line 21

def attributes
  super.update(self.class.primary_key => id)
end

#idObject



13
14
15
# File 'lib/superstore/attribute_methods/primary_key.rb', line 13

def id
  @id ||= self.class._generate_key(self)
end

#id=(id) ⇒ Object



17
18
19
# File 'lib/superstore/attribute_methods/primary_key.rb', line 17

def id=(id)
  @id = id
end