简体   繁体   中英

Displaying a Form, Perform Calculations, and Displaying Results in Ruby on Rails

Is there a good barebones rails app that displays one form (with some selectors/text fields), performs some calculation on the entries, and displays the results of the calculations?

For some reason a few hours of searching has yet to result in a complete example that does the entire workflow itself - often the calculations are passed off to another site.

Essentially what I'm looking for is a simple Rails HTML Form processor...

Thank you! Doug

I would actually recommend picking up a Rails book and digging in to thoroughly understand the architecture. There are a lot of examples out there of setting up blogs but most end up showing you scaffolding which (in my experience) is typically useless on real projects.

Nevertheless, Rails does make it fairly simple to process form data (usually params[:my_model] or just the params hash directly) and respond to the client from within the controller action. I suppose in your final solution, the action will make a call to the remote site to "POST" the result or delegate that behavior to a model.

Hopefully some of this answers your concerns and appears less as a RTFM comment. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM