Hey all, Let's say you want a customized route. You want to create a helper for it (e.g. password_recovery_root_path) and a url path (e.g. passwords/recovery) that when it is invoked, points the user to the passwords controller's get_email method. So you would do this:
map.resources :passwords, :only => %w(new create), :collection => {:check => :post} map.with_options :name_prefix => "password_recovery_", :path_prefix => "passwords/recovery", :controller => "passwords" do |password_recovery| password_recovery.root :action => "get_email" ... (more code) end Now when the get_email method is invoked, it checks if the email key contains a value in query string, and if so, it links user somewhere else. Otherwise it renders a view email.html.haml, which is exactly the same page that got loaded when the get_email method was called first: def get_email if params[:email].present? @user = User.find_by_email!(params[:email]) redirect_to password_recovery_show_questions_path(:email => params[:email]) else render "password_recovery/email" end end The view in question is located in password_recovery/email.html.haml. When you look at server logs, you can see this: Started GET "/passwords/recovery" Processing by PasswordsController#get_email as HTML Rendered password_recovery/email.html.haml My question is when that get_email method was called, we never specified to render password_recovery/email.html.haml . The only time when that is specified is when the user clicks the submit button and a get request is sent to server and if nothing passed in email query string, then the page simply reloads via render "password_recovery/email". However, the second time it reloads, there are some additional parameters in the query string: /passwords/recovery?utf8=%E2%9C%93&email=&commit=Continue. Since what the get_email method is doing is clear as day, I am not sure 1) how rails knows to load the specific email view when the page is first routed, as shown above 2) and where those additional parameters came from that were passed into query string the second time page load (if no email was provided). Thanks for response. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.