# Accessing :object after render : partial

**URL:** <https://www.ruby-forum.com/t/accessing-object-after-render-partial/155574>\
**Category:** Ruby\
**Created:** [December 13, 2008, 7:44pm UTC](https://www.ruby-forum.com/t/accessing-object-after-render-partial/155574 "2008-12-13T19:44:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thithi32](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@thithi32](https://www.ruby-forum.com/u/thithi32)\
**Post date:** [December 13, 2008, 7:44pm UTC](https://www.ruby-forum.com/t/accessing-object-after-render-partial/155574/1 "2008-12-13T19:44:42Z")

</div>

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\*: \<%= course.distance %\>

BUT I tells me “course” doesn’t exist: “undefined local variable or  
method ‘course’”

Please, can someone help me through this one???

---

<div class="post-metadata">

**Author:** ![thithi32](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@thithi32](https://www.ruby-forum.com/u/thithi32)\
**Post date:** [December 13, 2008, 8:50pm UTC](https://www.ruby-forum.com/t/accessing-object-after-render-partial/155574/2 "2008-12-13T20:50:39Z")

</div>

On Sat, Dec 13, 2008 at 12:37 PM, Thierry D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Distance\*: \<%= course.distance %\>
> 
> 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](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

---

<div class="post-metadata">

**Author:** ![thithi32](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@thithi32](https://www.ruby-forum.com/u/thithi32)\
**Post date:** [December 13, 2008, 9:02pm UTC](https://www.ruby-forum.com/t/accessing-object-after-render-partial/155574/3 "2008-12-13T21:02:57Z")

</div>

On Dec 13, 2008, at 10:37 , Thierry D. 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.

---

<div class="post-metadata">

**Author:** ![thithi32](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b782af/32.png) [@thithi32](https://www.ruby-forum.com/u/thithi32)\
**Post date:** [December 13, 2008, 9:21pm UTC](https://www.ruby-forum.com/t/accessing-object-after-render-partial/155574/4 "2008-12-13T21:21:19Z")

</div>

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
