Here is my use case I have a search model with two actions search_set and search_show. 1 - A user loads the home page which contains a search_form, rendered via a partial (search_form). 2 - User does a search, and the request goes to search_set, the search is saved and a redirect happens to search_show page which again renders the search_form with the saved search preferences. This search form is different than the one if step1, because it''s a remote form being submitted to the same action (search set) 3 - Now the user does another search, and the search form is submitted via ajax to the search_set action. The search is saved and executed and now I need to present the result via rjs templates (corresponding to search_show). I am told that if the request is xhr then I can''t redirect to the search_show action? Is that right? If yes, how do I handle this? Thanks -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hi, What you cannot do is mixing Ajax requests with full URL page requests But what you can do is something like: format.js { render :action=> search_show, :layout=>false } Your search_show view will be rendered without any application layout provided you''re using the same content @variables.. Jan On Jun 6, 2:25 am, badnaam <asitkmis...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Here is my use case > > I have a search model with two actions search_set and search_show. > > 1 - A user loads the home page which contains a search_form, rendered > via a partial (search_form). > > 2 - User does a search, and the request goes to search_set, the search > is saved and a redirect happens to search_show page which again > renders the search_form with the saved search preferences. This search > form is different than the one if step1, because it''s a remote form > being submitted to the same action (search set) > > 3 - Now the user does another search, and the search form is submitted > via ajax to the search_set action. The search is saved and executed > and now I need to present the result via rjs templates (corresponding > to search_show). I am told that if the request is xhr then I can''t > redirect to the search_show action? Is that right? If yes, how do I > handle this? > > Thanks-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
With my search forms, I use two partials, one for the controls and one for the result and then just use a page update to redisplay both parts. If you really want a redirect On Jun 6, 11:25 am, javinto <jan.javi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> format.js { > render :action=> search_show, :layout=>false > } >javinto, Interesting, something I have not tried. Is this an ajax update response, in which case, the part of the dom being updated would presumably need to be the part generated by the yield in the layout? badnaam I use ajax search forms and handle the update as two partials, one for the controls and one for the results, using render :update Tonypm -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> to search_show). I am told that if the request is xhr then I can''t > redirect to the search_show action? Is that right? If yes, how do I > handle this? >Hi If what I understood from your post is correct, you can do from controller like render :update do |page| page.redirect_to search_show_url end Sijo -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.