<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Rails Forum - Ruby on Rails Help and Discussion Forum - find :all, :conditions => using datetime]]></title>
		<link>http://railsforum.com/viewtopic.php?id=1307</link>
		<description><![CDATA[The most recent posts in find :all, :conditions => using datetime.]]></description>
		<lastBuildDate>Thu, 02 Dec 2010 18:16:48 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: find :all, :conditions => using datetime]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=133959#p133959</link>
			<description><![CDATA[<p>Hi, I am a beginner from Argentina..and these posts were useful for me.<br />Thanks for sharing them.</p>]]></description>
			<author><![CDATA[dummy@example.com (guillote)]]></author>
			<pubDate>Thu, 02 Dec 2010 18:16:48 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=133959#p133959</guid>
		</item>
		<item>
			<title><![CDATA[Re: find :all, :conditions => using datetime]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=6550#p6550</link>
			<description><![CDATA[<p>Dont worry we are all new once <img src="http://railsforum.com/img/smilies/smile.png" width="15" height="15" alt="smile" />&nbsp; The good this is from my experience we have a fairly good community here, although I probably need to start answering more things than asking <img src="http://railsforum.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (Catharsis)]]></author>
			<pubDate>Thu, 23 Nov 2006 11:31:32 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=6550#p6550</guid>
		</item>
		<item>
			<title><![CDATA[Re: find :all, :conditions => using datetime]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=6406#p6406</link>
			<description><![CDATA[<p>Unbelievable! And I thought I tried all different combinations of the &#039;?&#039; substitution...<br />It&#039;s hard being a newbie...</p><p>Your solution worked perfectly and it is so much more elegant.</p><p>Thank you thabenksta!</p><p>Fabricio.</p>]]></description>
			<author><![CDATA[dummy@example.com (fabsanchez)]]></author>
			<pubDate>Tue, 21 Nov 2006 10:54:09 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=6406#p6406</guid>
		</item>
		<item>
			<title><![CDATA[Re: find :all, :conditions => using datetime]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=6374#p6374</link>
			<description><![CDATA[<p>Try this</p><p><pre name="code" class="ruby:nogutter">bugs = Bug.find :all, :order =&gt; &#039;id DESC&#039;,<br />&nbsp; &nbsp; :conditions =&gt; [&#039;status_id = &quot;3&quot; AND date_fixed &gt; ? AND date_fixed &lt;= ? AND product_id = ?&#039;, start_date, end_date, params[:id]]</pre><br />There&#039;s always a more elegant way with Rails <img src="http://railsforum.com/img/smilies/wink.png" width="15" height="15" alt="wink" /></p>]]></description>
			<author><![CDATA[dummy@example.com (thabenksta)]]></author>
			<pubDate>Mon, 20 Nov 2006 22:14:35 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=6374#p6374</guid>
		</item>
		<item>
			<title><![CDATA[Re: find :all, :conditions => using datetime]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=6353#p6353</link>
			<description><![CDATA[<p>I found this which seems to do the job, although I thought there would be a way to do it without me having to convert the datetime value to a database datetime.</p><p>bugs = Bug.find :all, :order =&gt; &#039;id DESC&#039;,<br />&nbsp; &nbsp; :conditions =&gt; &#039;status_id = &quot;3&quot; AND date_fixed &gt; &quot;&#039; + start_date.strftime(&#039;%Y-%m-%d %H:%M:%S&#039;) + &#039;&quot; AND date_fixed &lt;= &quot;&#039; + end_date.strftime(&#039;%Y-%m-%d %H:%M:%S&#039;) + &#039;&quot; AND product_id = &#039; + params[:id]</p><p>If anyone has a more elegant way of doing this, please let me know anyway.</p><p>Thanx,</p><p>Fabricio</p>]]></description>
			<author><![CDATA[dummy@example.com (fabsanchez)]]></author>
			<pubDate>Mon, 20 Nov 2006 15:43:34 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=6353#p6353</guid>
		</item>
		<item>
			<title><![CDATA[find :all, :conditions => using datetime]]></title>
			<link>http://railsforum.com/viewtopic.php?pid=6350#p6350</link>
			<description><![CDATA[<p>Hi there,</p><p>I&#039;m new at ruby on rails and can&#039;t find the correct way to work with dates and datetimes as part of the condition of a find.</p><p>I want to find all ActiveRecords between two datetimes (start_date and end_date):</p><p>bugs = Bug.find :all, <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :order =&gt; &#039;id DESC&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; :conditions =&gt; &#039;status_id = &quot;3&quot; AND date_fixed &gt; &#039; + start_date + &#039; AND date_fixed &lt;= &#039; + end_date + &#039; AND product_id = &#039; + params[:id]</p><br /><p>Is there a direct way to pass dates/datetimes onto a query for comparison?<br />Is the way that I&#039;ve written the condition above ok, is there a preferrred method to pass multiple conditions?</p><p>Any help greatly appreciated.</p><p>Regards,</p><p>Fabricio.</p>]]></description>
			<author><![CDATA[dummy@example.com (fabsanchez)]]></author>
			<pubDate>Mon, 20 Nov 2006 13:52:07 +0000</pubDate>
			<guid>http://railsforum.com/viewtopic.php?pid=6350#p6350</guid>
		</item>
	</channel>
</rss>
