|
|
@@ -2,7 +2,7 @@
|
|
|
class Product < ActiveRecord::Base
|
|
|
has_paper_trail
|
|
|
self.table_name = 'products'
|
|
|
-
|
|
|
+ Thread.current[:current_user] = @current_user
|
|
|
scope :active, -> { where(ptype: "cent_sale") }
|
|
|
scope :inactive, -> { where(ptype: "direct_sale") }
|
|
|
belongs_to :product_cat, :foreign_key => :category_id
|
|
|
@@ -117,11 +117,12 @@ class Product < ActiveRecord::Base
|
|
|
end
|
|
|
|
|
|
def gross_interest_rate
|
|
|
+ controller = bindings[:controller]
|
|
|
rate = 0
|
|
|
if self.buy_price != 0 && self.price != 0
|
|
|
rate = (( self.price.to_f - self.buy_price.to_f )/self.buy_price.to_f)*100
|
|
|
end
|
|
|
- return rate
|
|
|
+ return current_admin_user.email
|
|
|
end
|
|
|
|
|
|
rails_admin do
|