Sha256: 4d331e9cc48fd0a5dc45b85f09282556fbf0854359c182326d3ca96bc5a714a5

Contents?: true

Size: 353 Bytes

Versions: 8

Compression:

Stored size: 353 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

8 entries across 8 versions & 1 rubygems

Version Path
spree_favorite_products-3.0.0 app/models/spree/favorite.rb
spree_favorite_products-2.0.3 app/models/spree/favorite.rb
spree_favorite_products-2.2.3 app/models/spree/favorite.rb
spree_favorite_products-2.2.2 app/models/spree/favorite.rb
spree_favorite_products-2.0.2 app/models/spree/favorite.rb
spree_favorite_products-2.2.0 app/models/spree/favorite.rb
spree_favorite_products-2.0.1 app/models/spree/favorite.rb
spree_favorite_products-2.0.0 app/models/spree/favorite.rb