Ruby on Rails
Friday, July 6, 2018
Sorry, I couldn't find a quote button on the mobile version.
I have been thinking more about it. Perhaps I can simply rename my controller, model, and view to "Certification Application" or "Certification Request" then create a model for "Individual Name" and create a has_many relationship. Technically, a "Certification" cannot have many individual names. However, a "Certification Application" or "Certification Request" can easily have many individual names. I can then use the Cocoon gem and make a nested form. The biggest challenge I see is making each dynamically created field increase the quantity. Perhaps I should have hidden fields for quantity and price that can dynamically get adjusted. Then upon submission, those can be passed to the backend which will calculate the correct amount to send to Stripe. Does this sound like the right approach?
Thank you again for the assistance.
On Friday, June 29, 2018 at 12:33:15 AM UTC-7, Colin Law wrote:
On 28 June 2018 at 21:49, Julian Medina <julian....@gmail.com> wrote:
> Thanks! So essentially I could have a separate button for volume purchases which would bring up a different view? Would I then have a loop in my controller that would create records for each person who is getting certified?
Since you haven't quoted the previous message we don't know who this
is addressed to. Assuming it was my suggestion that you could have a
different action in the same controller then presumably yes, that is
what you would do. Of course the code can get tricky as you may have
to allow for problems saving the record for each one (caused by
validation errors) and work out how to handle that.
Colin
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6310da63-39d6-4976-92cc-4cad6a9c9e09%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment