What are the best practices (or common practices) when it comes to adding extra steps to a process in Rails?
For example, I work with the Spree e-commerce Rails platform , and I would like to add a multi-stage form that people should fill out when trying to "Add to Cart" Product.
Currently, the implementation of adding a product to the basket is mainly:
ProductsController#show -> OrdersController#edit
This adds the product to the basket and leaves you in the basket.
So, Iโm interested in order to change the base code in spree as much as possible, how to do this, so that the process looks more like this:
ProductsController#show -> SurveysController#show -> (survey stuff...) -> OrdersController#edit
What I'm going to do is:
- change "products / show.html.erb" to go to survey_controller.rb. Also modify products_controller.rb to supply
session[:redirect_to] = order_checkout_pathwhich I can handle in SurveysController. - or just create these extra pop-ups, and when I get to the last, ask him to call the original method.
What is wrong with that? Which approach is better? This is a question, in general, about how people go to the architecture of multi-stage processes without changing the kernel code. Not a wizard , just adding extra things in the middle of other things.
Thanks for your help, Spear
source
share