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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey, so in the app I'm working on, the "owner" of the
Pay::Customerobject 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
nameand if not checking if it can form a string by combiningfirst_nameandlast_name. Because my team responds tonameI get the team name in Stripe Checkout, which in this case is incorrect.I get the correct email because my
Teammodel delegatesemailto the appropriate user on theTeam. I'm trying to do something similar forname, but obviously I needTeamto respond tonamewith the name of theTeam.Teamdoesn't, in this case, need to respond toemailsoemailcan be delegated but I guessTeamcould feasibly have anemailattribute, and that would raise the same issue.I considered updating the
customer_namemethod linked to above to first check for another attribute, e.g.billing_customer_nameorcustomer_name_on_cardor something like that. This would allow me to delegate that method in the same way that I'm currently delegating theemailattribute, 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_customerstable, 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