Hello all, I have a named scope ''profile'' that points to ''users/edit'' (there is no id as I''m using Authlogic). When the update fails, I want to keep the same url /profile and keep my error messages. How do I do this? Using render :action => ''edit'' or ''profile'' (I set up a profile template to test it) Redirect allows me to keep the url but I lose the error messages. Am I doing something ultra simple wrong? Thank you -ants -- 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.
Ants Pants wrote in post #958778:> Hello all, > > I have a named scope ''profile'' that points to ''users/edit'' (there is no > id > as I''m using Authlogic).Did you mean a named *route*? This doesn''t make sense with a named scope.> When the update fails, I want to keep the same > url > /profile and keep my error messages. How do I do this? Using render > :action > => ''edit'' or ''profile'' (I set up a profile template to test it) Redirect > allows me to keep the url but I lose the error messages.Try render :template instead. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.
I did mean route, yes (it was late, I was tired) render :template => is the same as :action =>, it changes the url to users/:id, I want to keep my /profile url upon failure. On 2 November 2010 21:42, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Ants Pants wrote in post #958778: > > Hello all, > > > > I have a named scope ''profile'' that points to ''users/edit'' (there is no > > id > > as I''m using Authlogic). > > Did you mean a named *route*? This doesn''t make sense with a named > scope. > > > When the update fails, I want to keep the same > > url > > /profile and keep my error messages. How do I do this? Using render > > :action > > => ''edit'' or ''profile'' (I set up a profile template to test it) Redirect > > allows me to keep the url but I lose the error messages. > > Try render :template instead. > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
Please quote when replying. Ants Pants wrote in post #958927:> I did mean route, yes (it was late, I was tired) > > render :template => is the same as :action =>, it changes the url to > users/:id, I want to keep my /profile url upon failure....which render :template will do. Did you try it yet? Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org Sent from my iPhone -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 3 November 2010 18:38, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Please quote when replying. > > Ants Pants wrote in post #958927: > > I did mean route, yes (it was late, I was tired) > > > > render :template => is the same as :action =>, it changes the url to > > users/:id, I want to keep my /profile url upon failure. > > ...which render :template will do. Did you try it yet? > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org > > Sent from my iPhone > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > Yes, I have tried it as I said. It was one of the first things I did try.As I said, it acts like render :action and this is from the docs ..... Template rendering works just like action rendering except that it takes a path relative to the template root. The current layout is automatically applied. -- 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.
You have a named route for the edit-action, but don''t use one for the update-action, right? I think there is the answer to find. Make a new post-only named route for your update action. Or don''t use another route but define your resources with :as => "profile" resources :users, :as => "profile" Could this work for you? On 03/11/10 20:31, Ants Pants wrote:> > > On 3 November 2010 18:38, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org > <mailto:lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>> wrote: > > Please quote when replying. > > Ants Pants wrote in post #958927: > > I did mean route, yes (it was late, I was tired) > > > > render :template => is the same as :action =>, it changes the > url to > > users/:id, I want to keep my /profile url upon failure. > > ...which render :template will do. Did you try it yet? > > Best, > -- > Marnen Laibow-Koser > http://www.marnen.org > marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org <mailto:marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org> > > Sent from my iPhone > > -- > 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 > <mailto:rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > <mailto:rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > Yes, I have tried it as I said. It was one of the first things I did > try. As I said, it acts like render :action and this is from the docs > ..... Template rendering works just like action rendering except that > it takes a path relative to the template root. The current layout is > automatically applied. -- > 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.-- 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.
Ants Pants wrote in post #959111:> On 3 November 2010 18:38, Marnen Laibow-Koser <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: > >> Best, >> -- >> 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>>> . >> For more options, visit this group at >> http://groups.google.com/group/rubyonrails-talk?hl=en. >> >> Yes, I have tried it as I said. It was one of the first things I did try. > As I said, it acts like render :action and this is from the docs ..... > Template rendering works just like action rendering except that it takes > a > path relative to the template root. The current layout is automatically > applied.Hmm. My recollection is that render :action or render :template should not change the URL of the already selected controller action, so you should still see the profile URL. I''m not sure why this wouldn''t work, unless you''ve got some JavaScript doing funny things, or unless I''m misremembering. Best, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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.