Replies: 1 comment 1 reply
-
One option might be to first check if the model responds to e.g. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey, so in the app I'm working on, the "owner" of the
Pay::Customer
object isTeam
. In this case, teams have names - typically either a company name or a department name, but not the name of a person.I'm using Stripe Checkout, and Pay is able to send along the name of the customer for me. My problem is that it does this by first checking if the object responds to
name
and if not checking if it can form a string by combiningfirst_name
andlast_name
. Because my team responds toname
I get the team name in Stripe Checkout, which in this case is incorrect.I get the correct email because my
Team
model delegatesemail
to the appropriate user on theTeam
. I'm trying to do something similar forname
, but obviously I needTeam
to respond toname
with the name of theTeam
.Team
doesn't, in this case, need to respond toemail
soemail
can be delegated but I guessTeam
could feasibly have anemail
attribute, and that would raise the same issue.I considered updating the
customer_name
method linked to above to first check for another attribute, e.g.billing_customer_name
orcustomer_name_on_card
or something like that. This would allow me to delegate that method in the same way that I'm currently delegating theemail
attribute, but that seems unsatisfactory for 2 reasons:I think a better solution would be to optionally allow injecting name, and probably email as well, however I look into doing this, I think it always comes back to add columns to the
pay_customers
table, whcih I suspect we don't really want to do.So I guess my question is, how can I inject a name other than
owner#name
?Beta Was this translation helpful? Give feedback.
All reactions