Grant Blakeman wrote:> I have an action that displays a paginated list of events in one table
> of my database. I want it to display all of the events from
today''s date
> and onward (exclude past events, basically). This is as far as
I''ve
> gotten:
>
> def list
> @show_pages, @shows = paginate(:shows, :per_page => 15, :conditions
> => [''shows.date_time >= ?'', ''2007-01-08
22:01:00'' ], :order => %w(
> shows.date_time ))
> end
>
> Putting today''s date/time in the database query is where
I''m stuck. I
> manually entered the date/time you see above and it works perfectly.
Nevermind, I figured it out - placing Time.now without quotes did the
trick - I think I had originally been trying Date.now and getting now
results because time wasn''t included...
Here''s the working code:
def list
@show_pages, @shows = paginate(:shows, :per_page => 15,
:conditions => [''shows.date_time >= ?'', Time.now ],
:order => %w(
shows.date_time ))
end
--
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-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---