Not able to put into a object variable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Not able to put into a object variable

Naroor Rathish
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
[hidden email]
http://lists.rubyonrails.org/mailman/listinfo/rails
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not able to put into a object variable

Blake Watters
  :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
> [hidden email]
> http://lists.rubyonrails.org/mailman/listinfo/rails

_______________________________________________
Rails mailing list
[hidden email]
http://lists.rubyonrails.org/mailman/listinfo/rails
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Not able to put into a object variable

Naroor Rathish
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/.
_______________________________________________
Rails mailing list
[hidden email]
http://lists.rubyonrails.org/mailman/listinfo/rails
Loading...