app/models/piggybak/sellable.rb in piggybak-0.6.34 vs app/models/piggybak/sellable.rb in piggybak-0.7.0

- old
+ new

@@ -1,14 +1,11 @@ class Piggybak::Sellable < ActiveRecord::Base belongs_to :item, :polymorphic => true, :inverse_of => :piggybak_sellable - attr_accessible :sku, :description, :price, :quantity, :active, :unlimited_inventory, :item_id, :item_type - attr_accessible :item # to allow direct assignment from code or console - validates_presence_of :sku - validates_uniqueness_of :sku - validates_presence_of :description - validates_presence_of :price - validates_presence_of :item_type + validates :sku, presence: true, uniqueness: true + validates :description, presence: true + validates :price, presence: true + validates :item_type, presence: true validates_numericality_of :quantity, :only_integer => true, :greater_than_or_equal_to => 0 has_many :line_items, :as => :reference, :inverse_of => :reference def admin_label