I am new to ruby on rails.
Here is my routes.rb
RpxNowExample::Application.routes.draw do
root :to => "users#index"
resources :users
end
Normally my functionality is working fine, but I want to make a tweak. I want it to redirect to another view “promptemail” using the same controller calling another action if a condition is true i.e
if(@provider == "Twitter")
redirect_to :action => :promptemail
end
It should take me to that promptemail view.
You can pass a block to your resources definition to add extra actions outside of the standard:
The
:viaoption allows you to restrict on get, post, put etc, the:onparameter will take either :member, or :collection.:collectionwill operate on a collection, so similar to the index action,:memberwill operate on an individual record. As such if you specify your route as:on => :member, you will need to provide an object or id when you generate the route.More info about adding routes to resources can be found here: http://guides.rubyonrails.org/routing.html#adding-more-restful-actions