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?
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.)
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:
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.
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.)