Displaying 1 result from an estimated 1 matches for "persist_to_database".
2008 Jul 16
2
belongs_to causing endless loop on first call to save!
...t that--on the final
step--loads an Account model object based on the current session state, and
then calls save! on that model:
class PrimaryAccountUser < User
attr_reader :credit_card
def initialize(service_id)
@credit_card = {} #hash for storing credit card attributes
end
def persist_to_database
add_session_data_to_account(PrimaryAccount.new)
account.save!
@id = account.id
return account
end
private
def add_session_data_to_account(account) #adds the impl-specific things to
the account
if(!@credit_card.blank?)
card = CreditCard.new do |cc|
cc.acco...