Regressions in 1.2.2


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

map.with_options :name_prefix => 'admin_', :path_prefix => '/admin' do


  admin.resources 'games', :controller => 'admin/games'

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?

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.

I've submitted a patch for this last week. It's in ticket #7372.


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”

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?

#destroy is reserved for a member route I believe. The only change to
routing was that the :id option was required.

Hello Rick,

That was it!
I renamed my action to ‘trash’ and it now works like a charm.

Many thanks for your help.

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 =>,
              :html => {:method => 'post'}) do |f| -%>

    <%= render :partial => "form_profile", :locals => {:f => f,
:legend => legend} %>

  <% end -%>

== Routes
map.resources :partners

@partner is populated with a in the controller.

Any ideas?

-- James

Hello James,

Your form looks like a ‘create’ form.
If it’s right, I think you should try this :

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 =>, 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

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

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() } %>

== 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) } %>

== _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