On Sun, Nov 14, 2010 at 7:35 PM, KT <malokt@gmail.com> wrote:
> I'm trying to create a named_scope for people who were born this
> year. I have an application helper method defining "current_year".
>
> So far, I have this, but it's not filtering correctly. I think I need
> a BETWEEN, maybe? I know this is something easy I'm just not
> seeing... any help is appreciated!
>
> class Person < ActiveRecord::Base
Have you used a debugger or logging statements to see what the
values of :dob and :current_year are at this point? :-)
> :named_scope :born_this_year, :conditions => {:dob => :current_year}
> end
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment