Forum: Ruby Accessing :object after render : partial

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
018b3c8f428a528431a2ccd65b4d37e4?d=identicon&s=25 Thierry Delbart (thithi32)
on 2008-12-13 19:44
Hello,

I'm running into an issue I don't understand (I'm new to ruby):
in my "Journey" controller / "course_detail" action I render the
following partial (this is call by a Prototype Ajax function):

render :partial => 'courses/course_detail', :object => @course

in the _course_detail.erb file I have:

Distance*: <span id="courseDistance"> <%= course.distance %></span><br
/>

BUT I tells me "course" doesn't exist: "undefined local variable or
method 'course'"

Please, can someone help me through this one???
26a81e5badb9e002ab9ed3542036e584?d=identicon&s=25 Michael Libby (Guest)
on 2008-12-13 20:50
(Received via mailing list)
On Sat, Dec 13, 2008 at 12:37 PM, Thierry Delbart <tdelbart@yahoo.fr>
wrote:
> Distance*: <span id="courseDistance"> <%= course.distance %></span><br
> />
>
> BUT I tells me "course" doesn't exist: "undefined local variable or
> method 'course'"
>
> Please, can someone help me through this one???

Probably the @course object is available in your partial in a variable
named course_detail

If that doesn't work, try your question in the Rails Forum
http://www.ruby-forum.com/forum/3 -- the ruby-talk list is for general
Ruby discussion. The Rails forum is all Rails all the time. You'll get
a much more authoritative response there.

-Michael
5a837592409354297424994e8d62f722?d=identicon&s=25 Ryan Davis (Guest)
on 2008-12-13 21:02
(Received via mailing list)
On Dec 13, 2008, at 10:37 , Thierry Delbart wrote:

> I'm running into an issue I don't understand (I'm new to ruby):
> in my "Journey" controller / "course_detail" action I render the
> following partial (this is call by a Prototype Ajax function):

please ask these questions on the rubyonrails mailing list.
018b3c8f428a528431a2ccd65b4d37e4?d=identicon&s=25 Thierry Delbart (thithi32)
on 2008-12-13 21:21
Sorry I looked at the forum list and I thought this was the more
accurate. Next time I'll post those questions in forum 3.

And thanks Mickael, you got it right. Sometimes I really don't
understand the naming of ROR.

Thanks for you help!

-------- SOLVED
--------------------------------------------------------------
This topic is locked and can not be replied to.