13 lines
547 B
Ruby
13 lines
547 B
Ruby
class User < ApplicationRecord
|
|
# Include default devise modules. Others available are:
|
|
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
|
devise :database_authenticatable, :registerable,
|
|
:recoverable, :rememberable, :validatable,
|
|
:confirmable
|
|
has_one :address,dependent: :destroy,inverse_of: :user
|
|
accepts_nested_attributes_for :address, update_only: true
|
|
has_many :orders
|
|
has_and_belongs_to_many :variants
|
|
has_many :cart_items, -> { includes(:variant).order("cart_items.updated_at asc") }
|
|
end
|