I've something like that:
in layout :
links looks that :
<%= link_to month.strftime('%B, %Y'),
"/?y=#{month.strftime("%Y")}&m=#{month.strftime("%m")}" %>
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
some idea how to repair that
--
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---