Displaying 9 results from an estimated 9 matches for "payment_methods".
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...
2008 Jul 16
2
belongs_to causing endless loop on first call to save!
...Funny thing is, when I was incrementally saving the data, this issue never
arose--another way to put it, those relationships never caused a problem
when saving/retrieving already-existing rows.
In the model tier, I have 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 tabl...
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 I''m talking about
more concretely:
2007 Apr 20
7
Stubbing Model.new w/ block?
Ok, I followed the advice of the list and moved more code into my
model from my controller. When developing tests for this new code, I
ran into a problem...
My model code creates a receipt object and sets some values on it:
@receipt = Receipt.new do |r|
r.x = 1
r.y = 2
# etc
end
I wanted to be able to stub out Receipt.new so that I could set
expectations on the methods called on the
2005 Dec 19
0
Re: Rails Digest, Vol 15, Issue 392
Peter Bohm wrote:
> which way do you send the email? Using the raw TMail object as described
> in the HowToSendMimeMultipartEmailsWithActionMailer? Can you post some code?
I''ll describe the problem in a bit more detail, and then will describe what I did to solve it.
The site I''m working on wanted to send an acknowledgment to people using our e-commerce site. The message
2009 Oct 07
1
output validations errors form causing type error?
Hi,
I was wondering if it is possible to output validation errors in a
nested form? I suppose this should be possible, but I am experiencing
an error message that I can''t track down.
The error I get is the following :
TypeError in Store/orders#create
Showing app/views/store/orders/new.html.erb where line #45 raised:
can''t convert Array into String
This is ocurring in the
2007 Jun 21
2
expects with returns that returns the return value of the actual method
I''m trying to test some code that''s using active_merchant using the
following test. What I''d like to be able to do is verify that purchase is
called, however, rather than specifying the return value for purchase with
returns, I''d like it to return the actual return value provided if you
called the non mocked purchase method. Is this possible?
def test_charge
2007 Jun 21
3
only checking certain parameters for a method
I''m writing a test where I only care about one of the parameters being sent
to the method, does anyone think having a way to say that any value for a
parameter which I don''t care about is valid? I''m thinking something like:
def test_charge_is_for_10_bucks
gateway = test_gateway
member = Member.new
member.credit_card_number = "1"
2009 Aug 28
2
Association extension method
In my application a user working at a dropzone can manipulate
transactions against customer accounts. Here''s my models:
class Transaction < ActiveRecord::Base
belongs_to :account
end
class Account < ActiveRecord::Base
belongs_to :dropzone
has_many :transactions
end
class Dropzone < ActiveRecord::Base
has_many :transactions, :through => :accounts do
def