Hi, I''ve found two regressions in 1.2.2. Trac is down so this group seemed the best place to report. You can''t use symbols as keys for the session in functional tests anymore. In 1.2.1 this code sets the correct session: get(:index, {}, {:current_user_id => 1}) But in 1.2.2 the session is only set properly if you use a string: get(:index, {}, {''current_user_id'' => 1}) The code that reads the session in the controller uses the symbol key. The second problem is a problem with Restful routes. I have this route: map.with_options :name_prefix => ''admin_'', :path_prefix => ''/admin'' do |admin| admin.resources ''games'', :controller => ''admin/games'' end In 1.2.1 the admin_game_path method returns the correct path (/admin/ games''). In 1.2.2 this methods raises a RoutingError: admin_game_url failed to generate from {:action=>"show", :controller=>"admin/games"} - you may have ambiguous routes, or you may need to supply additional parameters for this route. content_url has the following required parameters: ["admin", "games", :id] - are they all satisifed? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Ouch, that routing error is a typo in my code. It''s supposed to be admin_games_path of course. The functional test doesn''t raise an error about this in 1.2.1 and it does in 1.2.2. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Feb 7, 2007, at 11:26, Thijs Cadier wrote:> You can''t use symbols as keys for the session in functional tests > anymore. In 1.2.1 this code sets the correct session: > get(:index, {}, {:current_user_id => 1}) > > But in 1.2.2 the session is only set properly if you use a string: > get(:index, {}, {''current_user_id'' => 1}) > > The code that reads the session in the controller uses the symbol key.I''ve submitted a patch for this last week. It''s in ticket #7372. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Hello, I just upgraded my app to Rails 1.2.2. My routes are : map.with_options :path_prefix => "/admin", :name_prefix => "admin_" do |m| m.resources :requests, :controller => "admin/requests", :collection => { :destroy => :delete, :search => :post } do |request| request.resources :histories, :path_prefix => "/admin/requests/:request_id", :name_prefix => "admin_", :controller => "admin/histories" end end I got this error : admin_destroy_requests_url failed to generate from {:action=>"destroy", :controller=>"admin/requests"}, expected: {:action=>"destroy", :id=>/[^\/;.,?]+/, :controller=>"admin/requests"}, diff: {:id=>/[^\/;.,?]+/} From this piece of code <% form_for(:request, :url => admin_destroy_requests_path, :html => { :method => :delete, :id => :adminDeleteForm, :name => :adminDeleteForm }) do |f| %> If I switch my app back to 1.2.1, everything works fine. Any idea? Thomas. On 2/7/07, Thijs Cadier <thijs@cadier.net> wrote:> > > Ouch, that routing error is a typo in my code. It''s supposed to be > admin_games_path of course. > > The functional test doesn''t raise an error about this in 1.2.1 and it > does in 1.2.2. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/7/07, Thomas Balthazar <thomas.tmp@gmail.com> wrote:> Hello, > > I just upgraded my app to Rails 1.2.2. > My routes are : > > map.with_options :path_prefix => "/admin", :name_prefix => "admin_" do |m| > m.resources :requests, :controller => "admin/requests", :collection => { > :destroy => :delete, :search => :post } do |request| > request.resources :histories, :path_prefix => > "/admin/requests/:request_id", :name_prefix => "admin_", :controller => > "admin/histories" > end > end > > I got this error : > admin_destroy_requests_url failed to generate from {:action=>"destroy", > :controller=>"admin/requests"}, expected: {:action=>"destroy", > :id=>/[^\/;.,?]+/, :controller=>"admin/requests"}, diff: {:id=>/[^\/;.,?]+/} > > From this piece of code > <% form_for(:request, :url => admin_destroy_requests_path, :html => { > :method => :delete, :id => :adminDeleteForm, :name => :adminDeleteForm }) do > |f| %> > > If I switch my app back to 1.2.1, everything works fine. > Any idea? > Thomas.#destroy is reserved for a member route I believe. The only change to routing was that the :id option was required. -- Rick Olson http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Hello Rick, That was it! I renamed my action to ''trash'' and it now works like a charm. Many thanks for your help. Thomas. On 2/7/07, Rick Olson <technoweenie@gmail.com> wrote:> > > On 2/7/07, Thomas Balthazar <thomas.tmp@gmail.com> wrote: > > Hello, > > > > I just upgraded my app to Rails 1.2.2. > > My routes are : > > > > map.with_options :path_prefix => "/admin", :name_prefix => "admin_" do > |m| > > m.resources :requests, :controller => "admin/requests", :collection > => { > > :destroy => :delete, :search => :post } do |request| > > request.resources :histories, :path_prefix => > > "/admin/requests/:request_id", :name_prefix => "admin_", :controller => > > "admin/histories" > > end > > end > > > > I got this error : > > admin_destroy_requests_url failed to generate from {:action=>"destroy", > > :controller=>"admin/requests"}, expected: {:action=>"destroy", > > :id=>/[^\/;.,?]+/, :controller=>"admin/requests"}, diff: > {:id=>/[^\/;.,?]+/} > > > > From this piece of code > > <% form_for(:request, :url => admin_destroy_requests_path, :html => { > > :method => :delete, :id => :adminDeleteForm, :name => :adminDeleteForm > }) do > > |f| %> > > > > If I switch my app back to 1.2.1, everything works fine. > > Any idea? > > Thomas. > > #destroy is reserved for a member route I believe. The only change to > routing was that the :id option was required. > > -- > Rick Olson > http://weblog.techno-weenie.net > http://mephistoblog.com > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/7/07, Rick Olson <technoweenie@gmail.com> wrote:> > #destroy is reserved for a member route I believe. The only change to > routing was that the :id option was required. >We''ve had an issue pop up with routes since 1.2.2. I''ve simplified the code that we''re using to something that still fails, and hopefully someone can shed some light on this. Ideally, I''d simplify one more step and say, "Hey that''s what was breaking it." But it doesn''t get much more simple that this, I don''t think. The following works fine with 1.2.1, but fails with 1.2.2. == Error message ActionController::RoutingError in Partners#new Showing app/views/partners/_form_builder.rhtml where line #7 raised: partner_url failed to generate from {:action=>"show", :controller=>"partners", :id=>nil}, expected: {:action=>"show", :controller=>"partners"}, diff: {:id=>nil} == View (Line #7 from above is the first line here.) <% form_for(:partner, :url => partner_path(:id => @partner.id), :html => {:method => ''post''}) do |f| -%> <%= render :partial => "form_profile", :locals => {:f => f, :legend => legend} %> <% end -%> == Routes map.resources :partners @partner is populated with a Partner.new in the controller. Any ideas? -- James --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
Hello James, Your form looks like a ''create'' form. If it''s right, I think you should try this : -- <% form_for(:partner, :url => partners_path(@partner), :html => {:method => ''post''}) do |f| -%> -- What changes : partnerS_path instead of partner_path and @partner instead of @partner.id Let me know if it changes something. I''m quite new to RESTful routes, so I''m not sure. Regards, Thomas. On 2/7/07, JDL <jamesludlow@gmail.com> wrote:> > > On 2/7/07, Rick Olson <technoweenie@gmail.com> wrote: > > > > #destroy is reserved for a member route I believe. The only change to > > routing was that the :id option was required. > > > > We''ve had an issue pop up with routes since 1.2.2. I''ve simplified > the code that we''re using to something that still fails, and hopefully > someone can shed some light on this. Ideally, I''d simplify one more > step and say, "Hey that''s what was breaking it." But it doesn''t get > much more simple that this, I don''t think. > > > The following works fine with 1.2.1, but fails with 1.2.2. > > == Error message > > ActionController::RoutingError in Partners#new > > Showing app/views/partners/_form_builder.rhtml where line #7 raised: > > partner_url failed to generate from {:action=>"show", > :controller=>"partners", :id=>nil}, expected: {:action=>"show", > :controller=>"partners"}, diff: {:id=>nil} > > > == View (Line #7 from above is the first line here.) > > <% form_for(:partner, :url => partner_path(:id => @partner.id), > :html => {:method => ''post''}) do |f| -%> > > <%= render :partial => "form_profile", :locals => {:f => f, > :legend => legend} %> > > <% end -%> > > > == Routes > map.resources :partners > > > @partner is populated with a Partner.new in the controller. > > > Any ideas? > > -- James > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
The problem, I believe, is that @partner is a new record (unsaved), and thus has no id. So when you try to do partner_path(:id => @partner.id), the routes now complain because :id is required for that route (as it always should have been before). What you really want is what Thomas, said: <% form_for :partner, :url => partners_path, ... %> Since you are submitting the form to the partners resource ("/ partners") to create the new partner. - Jamis On Feb 7, 2007, at 11:37 AM, Thomas Balthazar wrote:> Hello James, > > Your form looks like a ''create'' form. > If it''s right, I think you should try this : > > -- > <% form_for(:partner, :url => partners_path(@partner), > :html => {:method => ''post''}) do |f| -%> > -- > > What changes : partnerS_path instead of partner_path and @partner > instead of @partner.id > > Let me know if it changes something. > I''m quite new to RESTful routes, so I''m not sure. > > Regards, > Thomas. > > > On 2/7/07, JDL <jamesludlow@gmail.com> wrote: > On 2/7/07, Rick Olson <technoweenie@gmail.com> wrote: > > > > #destroy is reserved for a member route I believe. The only > change to > > routing was that the :id option was required. > > > > We''ve had an issue pop up with routes since 1.2.2. I''ve simplified > the code that we''re using to something that still fails, and hopefully > someone can shed some light on this. Ideally, I''d simplify one more > step and say, "Hey that''s what was breaking it." But it doesn''t get > much more simple that this, I don''t think. > > > The following works fine with 1.2.1, but fails with 1.2.2. > > == Error message > > ActionController::RoutingError in Partners#new > > Showing app/views/partners/_form_builder.rhtml where line #7 raised: > > partner_url failed to generate from {:action=>"show", > :controller=>"partners", :id=>nil}, expected: {:action=>"show", > :controller=>"partners"}, diff: {:id=>nil} > > > == View (Line #7 from above is the first line here.) > > <% form_for(:partner, :url => partner_path(:id => @ partner.id), > :html => {:method => ''post''}) do |f| -%> > > <%= render :partial => "form_profile", :locals => {:f => f, > :legend => legend} %> > > <% end -%> > > > == Routes > map.resources :partners > > > @partner is populated with a Partner.new in the controller. > > > Any ideas? > > -- James > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 2/7/07, Jamis Buck <jamis@37signals.com> wrote:> > The problem, I believe, is that @partner is a new record (unsaved), > and thus has no id. So when you try to do partner_path(:id => > @partner.id), the routes now complain because :id is required for > that route (as it always should have been before). What you really > want is what Thomas, said: > > <% form_for :partner, :url => partners_path, ... %> > > Since you are submitting the form to the partners resource ("/ > partners") to create the new partner. >Thanks. I see the difference now. It''s a piece of the view that gets reused for both new/create and edit/update (the http_method isn''t hard coded in the real view). I guess 1.2.2 is being more strict about things than 1.2.1. I''ll rework what I''ve got and let you know if I find any problems. Thanks again. -- James --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On 7.2.2007, at 16.19, Rick Olson wrote:> > On 2/7/07, Thomas Balthazar <thomas.tmp@gmail.com> wrote: >> Hello, >> >> I just upgraded my app to Rails 1.2.2. >> My routes are : >> >> map.with_options :path_prefix => "/admin", :name_prefix => >> "admin_" do |m| >> m.resources :requests, :controller => "admin/ >> requests", :collection => { >> :destroy => :delete, :search => :post } do |request| >> request.resources :histories, :path_prefix => >> "/admin/requests/:request_id", :name_prefix => >> "admin_", :controller => >> "admin/histories" >> end >> end >> >> I got this error : >> admin_destroy_requests_url failed to generate from >> {:action=>"destroy", >> :controller=>"admin/requests"}, expected: {:action=>"destroy", >> :id=>/[^\/;.,?]+/, :controller=>"admin/requests"}, diff: {:id=>/[^ >> \/;.,?]+/} >> >> From this piece of code >> <% form_for(:request, :url => admin_destroy_requests_path, :html => { >> :method => :delete, :id => :adminDeleteForm, :name >> => :adminDeleteForm }) do >> |f| %> >> >> If I switch my app back to 1.2.1, everything works fine. >> Any idea? >> Thomas. > > #destroy is reserved for a member route I believe. The only change to > routing was that the :id option was required.Also, you should be using the singular form for a member path (destroy_request_url instead of destroy_requests_url). I noticed this since I had accidentally used the plural form for a member path and it broke in 1.2.2. I see this is not the case for Thomas (since he isn''t passing the id and is thus effectively having a collection path), but it seems to have changed nevertheless. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi
On 2/7/07, Jarkko Laine <jarkko@jlaine.net> wrote:> > Also, you should be using the singular form for a member path > (destroy_request_url instead of destroy_requests_url). I noticed this > since I had accidentally used the plural form for a member path and > it broke in 1.2.2. > > I see this is not the case for Thomas (since he isn''t passing the id > and is thus effectively having a collection path), but it seems to > have changed nevertheless.Indeed. I cleaned up the code and am now using the following successfully. (Different view than what I posted before, but it was failing similarly before.) == new.rhtml <div id="registry_form"> <%= render :partial => "form_builder", :locals => { :http_method => "post", :action_uri_path => sample_registries_path() } %> </div> == edit.rhtml <div id="registry_form"> <%= render :partial => "form_builder", :locals => { :http_method => "put", :action_uri_path => sample_registry_path(:id => @registry, :partner_id => @parent) } %> </div> == _form_builder.rhtml (snippet) <% form_for(:registry, :url => action_uri_path, :html => {:method => http_method}) do |f| -%> <!-- [snip] Form things. --> <% end -%> Thanks again for the help, everyone. -- James --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---