Hi im doing a paypal payment, anyway, when i update the just the date and active to 1, i have no problems..
嗨我正在做paypal付款,无论如何,当我更新只是日期和活动为1,我没有问题..
But there is a active column , in a player table (not users table) that need to be updated to 1 because its 0 by default.
但是在播放器表(非用户表)中有一个活动列需要更新为1,因为它默认为0。
How can this be done.. because i get 'undefined local variable or method `player' for #'
怎么能这样做...因为我得到'未定义的局部变量或方法`播放器'为#'
here is my code
这是我的代码
class PaymentNotification < ActiveRecord::Base
attr_accessible :player_id, :transaction_id, :params, :status, :active
belongs_to :user
belongs_to :player
serialize :params
after_create :mark_susc_as_purchased
private
def mark_susc_as_purchased
if status == "Completed"
user.update_attributes(:purchased_at => Time.now)
user.update_attributes(:active => 1)
player.update_attributes(:active => 1)
end
end
end
My first guess is :active must me something else like player.active.. but that dosent work eitheir.
我的第一个猜测是:主动必须我像player.active那样的其他东西..但是那个剂量工作eitheir。
thanks
谢谢
1 个解决方案
#1
0
This is working now
现在正在运作
def mark_susc_as_purchased
if status == "Completed"
user.update_attributes(:purchased_at => Time.now)
user.update_attributes(:active => 1)
user.player.update_attributes(:active => 1)
end
end
#1
0
This is working now
现在正在运作
def mark_susc_as_purchased
if status == "Completed"
user.update_attributes(:purchased_at => Time.now)
user.update_attributes(:active => 1)
user.player.update_attributes(:active => 1)
end
end