I''m trying to find events created after an initial date. I''m
sure it''s
something obvious, but I''m not sure why this isn''t working:
def self.find_recent
find(:all, :conditions=>"created_at > #{Time.local(2006, 4, 27,
22, 0, 0)}")
end
Time for more caffeine for me...
On Mon, May 01, 2006 at 07:26:56AM -0400, Josh on Rails wrote:
} I''m trying to find events created after an initial date. I''m
sure it''s
} something obvious, but I''m not sure why this isn''t working:
}
} def self.find_recent
} find(:all, :conditions=>"created_at > #{Time.local(2006, 4, 27,
22, 0,
} 0)}")
} end
Try this:
def self.find_recent
find(:all, :conditions => [''created_at > ?'',
Time.local(2006, 4, 27, 22, 0, 0)])
end
The string substitution is not really what you want.
--Greg
Thanks, that did it! On 5/1/06, Gregory Seidman <gsslist+ror@anthropohedron.net> wrote:> On Mon, May 01, 2006 at 07:26:56AM -0400, Josh on Rails wrote: > } I''m trying to find events created after an initial date. I''m sure it''s > } something obvious, but I''m not sure why this isn''t working: > } > } def self.find_recent > } find(:all, :conditions=>"created_at > #{Time.local(2006, 4, 27, 22, 0, > } 0)}") > } end > > Try this: > > def self.find_recent > find(:all, :conditions => [''created_at > ?'', Time.local(2006, 4, 27, 22, 0, 0)]) > end > > The string substitution is not really what you want. > > --Greg > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >