Hi guys i am trying to figure out a named scope for Time.now I have this
so far in my application model
named_scope :on_time, lambda { |time| {
:conditions => [’(time = ?)’, Time.now] } }
then i will call it by using on_time but i get an undefined error
message
Hi John M.
Can you please tell how you call this named scope and what the
error trace says?
Sijo
John M. wrote:
Hi guys i am trying to figure out a named scope for Time.now I have this
so far in my application model
named_scope :on_time, lambda { |time| {
:conditions => [‘(time = ?)’, Time.now] } }
then i will call it by using on_time but i get an undefined error
message
You’re not using the block argument |time|-- why do you have it? And
why are you using the array syntax for :conditions when the hash syntax
would be better?
Best,
–Â
Marnen Laibow-Koser
http://www.marnen.org
[email protected]