hello friends , I was trying to select all the invoice items from the table invoiceitems with a condition.But I am getting a NULL array .Please help me in fixing this :: @oldinvoiceitems = Invoiceitems.find(:all, :conditions => [''invoice_id = :invoiceid'', { :invoiceid => ''params[:id]'' } ] ) Thanx and regards, Naroor Rathish, www.naroor.blogspot.com -- Posted via http://www.ruby-forum.com/.
:invoiceid => ''params[:id]'' should be :invoiceid => params[:id] Single quoting it passes the invoiveid in as a string literal and not the value from the request. Blake On Dec 16, 2005, at 12:52 AM, Naroor Rathish wrote:> hello friends , > > I was trying to select all the invoice items from the table > invoiceitems > with a condition.But I am getting a NULL array .Please help me in > fixing > this :: > > @oldinvoiceitems = Invoiceitems.find(:all, :conditions => > [''invoice_id = :invoiceid'', { :invoiceid => ''params[:id]'' } ] ) > > Thanx and regards, > Naroor Rathish, > www.naroor.blogspot.com > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Thanx Blake , Also Have a another doubt .Is this possible :: def new @invoiceitems = Invoiceitems.new @oldinvoiceitems = Invoiceitems.find(:all, :conditions =>[''invoice_id = :invoiceid'', { :invoiceid => params[:id] } ] end his is for initialising a new invoiceItems object and also finding and storing all the invoice items for a particular invoice id .I will be having a page ''new'' where all the previous invoice items can be stored and new can be added . Thanking you, Naroor Rathish Blake Watters wrote:> :invoiceid => ''params[:id]'' should be :invoiceid => params[:id] > > Single quoting it passes the invoiveid in as a string literal and not > the value from the request. > > Blake-- Posted via http://www.ruby-forum.com/.
CharlotteWatt@aol.com
2006-Jan-10 00:10 UTC
[Rails] Not able to put into a object variable
To Blake Watters This is your Mom. Please call me at 904-699-2375 cell or home 386-684-9328 Love Mom. Charlotte''s Credit Repair 904-699-2375-cell 904-726-1804 -fax -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060110/19553538/attachment.html