views:

24

answers:

0

Im trying to get a controller to create a new account with the user id filled in, this doesn't work in my controller or in the console, why? Any suggestions on how to implement this would be much appreciated.

class PaymentNotification < ActiveRecord::Base

after_create :add_account_to_market

private

def add_account_to_market
    if status == "Completed"
    line = LineItem.find(:first, :conditions => { :cart_id => cart.id })
      line.quantity.times do  
        Account.create(:user_id => cart.user_id)
      end
    end
 end

end