search for: paymentmethod

Displaying 4 results from an estimated 4 matches for "paymentmethod".

Did you mean: payment_method
2011 Nov 02
2
Specify and validate requirements on an ActiveRecord association
Looking for some guidance/support on what feels like might not be an uncommon use-case. `User.has_many accounts` `User.has_many payment_methods` `Account.belongs_to :user` `Account.belongs_to :payment_method` `PaymentMethod.has_many :accounts` There are lots of `Accounts`. When I (a `User`) want to assign accounts to a `PaymentMethod`, I really don''t want to scope against all of them, but rather only those that I own. While this can be done at the controller level, it feels like a data-level constraint. I w...
2009 Feb 26
1
Problem w/ActionWebService and Inheritance in Service Params
I have a service method that takes a PaymentMethod which can either be a CreditCard or a PayPal account. When I request the service and pass one or the other it always comes over as a PaymentMethod; the service doesn''t seem to know that the parameter is really a CreditCard or PayPal. Here''s some sample code that illustrates what...
2008 Jul 16
2
belongs_to causing endless loop on first call to save!
...ave the following classes defined: class PrimaryAccount < Account has_many :payment_methods, :foreign_key => "account_id" #using single table inheritance, which is why foreign key is not "primary_account_id" belongs_to :current_payment_method, :class_name => "PaymentMethod", :foreign_key => "current_payment_method_id" #points to same table, so I can have many payment_methods, but also mark as being the current one to bill ... class PaymentMethod < ActiveRecord::Base belongs_to :account #normal bidirectional association ... class CreditCard...
2009 Mar 10
0
autosave no longer a valid option for belongs_to?
..._belongs_to_association array. I also noticed that it''s not in the ActiveRecord API doc (ar.rubyonrails.org). Does anyone have any more information on this? What is the current best practice for persisting your child objects when saving a parent object? Here''s an example: class PaymentMethod < ActiveRecord::Base belongs_to :billing_address, :class_name => "Address" end class Address < ActiveRecord::Base validates_presence_of :line_one end class PaymentMethodsController < ActionController::Base def update @pm = PaymentMethod.find(params[:id]) @pm.bill...