query depending on between two values

0 views
Skip to first unread message

Subhadip Chakraborty

unread,
Mar 14, 2008, 1:30:50 PM3/14/08
to rubyonra...@googlegroups.com
hey, i am new in ruby..i have two textbox..where i will give
two dates.i will fire query for retriving data between two dates
given textboxes..pleaes give me any simple code.how will i proceed?
urgent..
controller code:
@result = params[:text]
@result1 = params[:text1]
@infos=Info.find(:all,:conditions =>
{:user_id=>params[:text]..params[:text1]})
but it will not worked?
please help with code..
--
Posted via http://www.ruby-forum.com/.

jemminger

unread,
Mar 15, 2008, 12:48:51 PM3/15/08
to Ruby on Rails: Talk
here's one way:

@infos = Info.find(:all, :conditions => ["my_date between ? and ?",
params[:date1], params[:date2]])


On Mar 14, 1:30 pm, Subhadip Chakraborty <rails-mailing-l...@andreas-
Reply all
Reply to author
Forward
0 new messages