Sha256: 9cfba2c776daccb68cdd481b3b495dc2e57b6830c0be49a86e69c943a6a0ac2b

Contents?: true

Size: 358 Bytes

Versions: 1

Compression:

Stored size: 358 Bytes

Contents

module Spree
  class Favorite < ActiveRecord::Base
    belongs_to :product
   
    belongs_to :user
    validates :user_id, :product_id, :presence => true
    validates :product_id, :uniqueness => { :scope => :user_id, :message => "already marked as favorite" }
    validates :product, :presence => { :message => "is invalid" }, :if => :product_id
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spree_favorite_products-2.3.0 app/models/spree/favorite.rb