Undefined method `name' for "41":String

plz see this
http://pastie.org/878267
reply if u find any error or suggestion…
plz its urgent

Regards,
Shyam
+91-9716-18-9650

On Sat, Mar 20, 2010 at 1:09 AM, shyam mohan
[email protected]wrote:

Shyam, local variables are not accessing within the view. Thus, you’ll
need
to change

charges = Charge.find(:all,:conditions =>“company_id =#{comp_id}”)

to

@charges = Charge.find(:all,:conditions => [ “company_id = ?” , comp_id
] )

Next, I would recommend reading “Agile Web D. with Rails 3rd”
as well

as the guides.rubyonrails.org.

Good luck,

-Conrad

Hi

Conrad

Thanks for replying
but problem was some thing else…
thanks

Regards,
Shyam
+91-9716-18-9650

On Sat, Mar 20, 2010 at 3:01 AM, shyam mohan
[email protected]wrote:

Shyam
+91-9716-18-9650

Did you resolve the issue?

-Conrad

On 20 March 2010 10:08, Colin L. [email protected] wrote:

You have

<%=h charge.name %>

Where is the variable called charge setup?

I think in the cherry-picking of code to put into pastie, an “each”
line was missed out around here:
<% charges = params[:charges]
if charges %>
<%=h charge.name %>

But the upshot is; if you are populating “charges” from the params
hash, what is in params? I’d put money on params[:charges] returning
an array of integers that are ids of charges (hence getting “undefined
method `name’ for “41”:String” as the error). If you want “charges” to
be a collection of Charge objects that match the ids in
params[:charges] - get that all sorted in the controller.

On 20 March 2010 08:09, shyam mohan [email protected] wrote:

plz see this
http://pastie.org/878267
reply if u find any error or suggestion…
plz its urgent

You have

<%=h charge.name %>

Where is the variable called charge setup?

You might like to have a look at rails guide on debugging, it will
show you several ways of analysing this sort of issue when you cannot
see the problem by code inspection. http://guides.rubyonrails.org/
Look particularly at the use of ruby-debug.

Colin