Hello,
Firstly, numeric months are "%m" , so maybe changing "M" to
"m" will be
enough.
But, :conditions have to be written pretty much in SQL, and I think you need
to pass in whole SQL date strings as well. Try something like:
:conditions => [ "birthdate BETWEEN Time.now.strftime("%Y-%m-%01
%H:%M:%S") AND Time.now.strftime("%Y-%m-%31 %H:%M:%S")" ])
Actually, rails extends Date and Time in neat ways. You could write
something like Time.now.at_beginning_of_month.to_s(:db) instead of mucking
about with strftime at all.
You can read up on all that in
ActiveSupport::CoreExtensions::Time::Calculations in the api docs.
Lemme know if that works for you.
J
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---