Erol Fornoles wrote in post #961514:
> On Mon, Nov 15, 2010 at 11:35 AM, KT <mal...@gmail.com> wrote:
>
>> :named_scope  :born_this_year, :conditions => {:dob => :current_year}
>> end
>
>
> Assuming your :dob is a date
>
> Try :conditions => ['dob BETWEEN ? AND ?', Date.today.beginning_of_year,
> Date.today.end_of_year]

Even better:

:conditions => ['year(dob) = ?', Date.today.year]

>
> --
> Erol M. Fornoles

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org

-- 
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 rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to