That would escape your URI correctly, but this can't be your problem because either way these are just numbers, not punctuation that needs escapes.
in controler I've :
if params[:y] && params[:m]
@posts = Post.find(:all,:order => 'created_at' ,:conditions =>
['extract(year from created_at) LIKE ? AND extract(month from
created_at) LIKE ?', params[:y], params[:m]] )
else
@posts = Post.find(:all)
end
but in console I've got that sql code:
SELECT * FROM "posts" WHERE (extract(year from created_at) LIKE E'2009'
AND extract(month from created_at) LIKE E'01') ORDER BY created_at
looks like this E near that LIKE broke everything
I can't see where the E comes from, but why the LIKE? Your year and month have no % in them for LIKE to wildcard.
Can your "functional" test call this action correctly?
Processing PostsController#index (for 127.0.0.1 at 2009-01-11 17:24:48)
[GET]
Parameters: {"m"=>"01", "y"=>"2009"}
SQL (0.1ms) SET client_min_messages TO 'panic'
SQL (0.1ms) SET client_min_messages TO 'notice'
Post Load (4.5ms) SELECT * FROM "posts" WHERE (extract(year from
created_at) = E'2009' AND extract(month from created_at) = E'01') ORDER
BY created_at
Rendering template within layouts/application
Rendering posts/index
SQL (1.1ms) SELECT count(*) AS count_all FROM "comments" WHERE
("comments".post_id = 2)
CACHE (0.0ms) SELECT count(*) AS count_all FROM "comments" WHERE
("comments".post_id = 2)
Rendered posts/_post (23.8ms)
SQL (0.6ms) SELECT count(*) AS count_all FROM "comments" WHERE
("comments".post_id = 1)
CACHE (0.0ms) SELECT count(*) AS count_all FROM "comments" WHERE
("comments".post_id = 1)
Rendered posts/_post (4.5ms)
Post Load (13.5ms) SELECT * FROM "posts" ORDER BY created_at
Rendered arrays/_array (0.7ms)
Completed in 72ms (View: 43, DB: 20) | 200 OK
[http://127.0.0.1/?y=2009&m=01]