Rails multistep form with ajax

I am following Railscasts #217 and I have been able to make everything work using html protocol the only issue is that I need it to use ajax protocol instead. My question and code is very similar to stackoverflow question Multistep forms in Rails using AJAX . I understand how to setup ajax and make the form sumit remotely my question though is how do I pass over the forms variable i.e. “f” as in “<%= form_for @post do |f|>” Any help is appreciated.

Originally asked at http://stackoverflow.com/questions/18001406/rails-multistep-form-with-ajax-modification

Seth Portman wrote in post #1117487:

I am following Railscasts #217 and I have been able to make everything
work
using html protocol the only issue is that I need it to use ajax
protocol
instead. My question and code is very similar to stackoverflow question
Multistep
forms in Rails using

AJAX<http://stackoverflow.com/questions/14228368/multistep-forms-in-rails-using-ajax>

.
I understand how to setup ajax and make the form sumit remotely my
question
though is how do I pass over the forms variable i.e. "f" as in "<%=
form_for @post do |f|>" Any help is appreciated.

I think you're probably making this too complicated. If you're using
JavaScript anyway then just have one page, with one form. Use JavaScript
(no AJAX required) to show and hide the fields for the various steps in
the process. Ryan mentioned, and recommended, this approach at the
beginning of the episode.

Since have have only a single page with a single form there's nothing to
pass around. The are no changes required in your controller or model
classes. As far as Rails is concerned it's no different than a regular
form submission.

If your multi-step form is extremely complex then I might suggest
considering one of the single page app solutions such as Ember.js,
Backbone.js or Angular.js.