|
|
@@ -2,6 +2,8 @@
|
|
|
class Product < ActiveRecord::Base
|
|
|
has_paper_trail
|
|
|
self.table_name = 'products'
|
|
|
+ before_filter :authenticate_admin_user!
|
|
|
+
|
|
|
scope :active, -> { where(ptype: "cent_sale") }
|
|
|
scope :inactive, -> { where(ptype: "direct_sale") }
|
|
|
belongs_to :product_cat, :foreign_key => :category_id
|
|
|
@@ -121,7 +123,7 @@ class Product < ActiveRecord::Base
|
|
|
rate = (( self.price.to_f - self.buy_price.to_f )/self.buy_price.to_f)*100
|
|
|
end
|
|
|
#return ((rate*100).round.to_f/100).to_s + "%"
|
|
|
- user= RailsAdmin.config.admin_user
|
|
|
+ user= admin_user
|
|
|
return user
|
|
|
end
|
|
|
|