|
|
@@ -2,7 +2,6 @@
|
|
|
class Product < ActiveRecord::Base
|
|
|
has_paper_trail
|
|
|
self.table_name = 'products'
|
|
|
- authorize! :index, @user, :message=> 'Not authorized as an administrator.'
|
|
|
|
|
|
scope :active, -> { where(ptype: "cent_sale") }
|
|
|
scope :inactive, -> { where(ptype: "direct_sale") }
|
|
|
@@ -123,8 +122,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= session_path(user_id)
|
|
|
- return @user
|
|
|
+ return @current_user.email
|
|
|
end
|
|
|
|
|
|
rails_admin do
|
|
|
@@ -132,7 +130,7 @@ class Product < ActiveRecord::Base
|
|
|
weight -240
|
|
|
|
|
|
list do
|
|
|
- #authorize! :index, @user, :message=> 'Not authorized as an administrator.'
|
|
|
+ # authorize! :index, @user, :message=> 'Not authorized as an administrator.'
|
|
|
|
|
|
scopes [:inactive]
|
|
|
|