Re: [Rails] Help with queries
Need quotes:
created_at <= \"#{Time.now}\" AND created_at >= \"#{Time.now-1.month}\"
but you can to do that way
.where(:company_id => @company.id).where(:created_at => Time.now..Time.now-1.month)
2011/7/24 Rodrigo Ruiz <rodrigo.ruiz7@gmail.com>
Hi, Id like to do something like that:@payment_history = PaymentHistory.where("company_id = #{@company.id} AND created_at <= #{Time.now} AND create_at >= #{Time.now - 1.month}").firstproblem is it doesn't seen to let me compare the create_at attribute with Time.now.Anyone knows the proper way to do this?Thank you,Rodrigo--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
--
Fernando Almeida
www.fernandoalmeida.net
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home