<% form_remote_for :user, @user, :url => { :action => "create" } do |f| %> . . <%= submit_tag "Add user" %> controller: def create @user = User.new(params[:user]) if @user.save if(request.xhr?) flash[:notice] = "OK ADDED" redirect_to :action => :index else flash[:notice] = "not xhr" end end end When I run this, it doesn''t seem to pass request.xhr? so it never redirects. What''s wrong with this? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Justin To wrote:> <% form_remote_for :user, @user, :url => { :action => "create" } do |f| > %> > .Are you still nesting one form inside in another. Are you including prototype (javascript_include_tag) ? Fred> . > <%= submit_tag "Add user" %> > > > controller: > def create > @user = User.new(params[:user]) > > if @user.save > if(request.xhr?) > flash[:notice] = "OK ADDED" > redirect_to :action => :index > else > flash[:notice] = "not xhr" > end > end > end > > > When I run this, it doesn''t seem to pass request.xhr? so it never > redirects. > > What''s wrong with this? > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---