Connecting Tech Pros Worldwide Help | Site Map

Displaying Records between 2 dates

  #1  
Old April 7th, 2009, 11:26 AM
Newbie
 
Join Date: Apr 2009
Posts: 1
How to display the records between 2 dates in ruby on rails
I have 2 text boxes where i fill the 2 dates and want to display the records between these 2 dates from the database tables

Thanks in advance,
vaibhavi,,,
  #2  
Old April 7th, 2009, 02:44 PM
Expert
 
Join Date: May 2007
Posts: 213

re: Displaying Records between 2 dates


You can use :conditions
Expand|Select|Wrap|Line Numbers
  1. data = ModelName.find(:all, :conditions => "date >= 'yyyy-mm-dd' and date <= 'yyyy-mm-dd'")
or you can write the SQL query, then use ModelName.find_by_sql(query).
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
displaying record between two dates errors rjlorenzo answers 8 October 12th, 2008 09:29 AM
Performance based on design dweitz answers 5 April 30th, 2008 04:33 AM
problem with displaying records between two dates sejal17 answers 5 March 3rd, 2008 10:40 AM
Displaying records without Dates in the end of the section jkuruvil answers 4 October 20th, 2006 03:12 PM