Read you code again!

You're telling Ruby: "compare the :created_at symbol with Time.now". The 
correct syntax would be:

Post.where{ created_at <= Time.now }

Note that I'm using round brackets, not plain parentheses.

Alternatively, you can do everything server-side using this:

Post.filter('created_at <= NOW()')

Hope that helps!

-- 
François Beausoleil
http://github.com/francois

Le jeudi 9 juin 2011 à 15:12, Artyom Bolshakov a écrit :

> Hi,
> I have a such code:
>  @posts = Post.where(:created_at <=
> Time.now).reverse_order(:created_at).paginate(1, 10)
> 
> Then I run it got this error:
>  ArgumentError: comparison of Symbol with Time failed
> 
> What wrong with it? I going to find posts created earlier then date
> specified.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sequel-talk" group.
> To post to this group, send email to [email protected] 
> (mailto:[email protected]).
> To unsubscribe from this group, send email to 
> [email protected] 
> (mailto:[email protected]).
> For more options, visit this group at 
> http://groups.google.com/group/sequel-talk?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to