Partial not passing

Hi there,

I have a partial like this:

<%= render :partial => @person.address %>

and in app/views/addresses/_address.html.erb:

Street: <%= address.street %>

But address in the partial is nil… shouldn’t the local variable
‘address’ be available in the partial? And why is it nil?

Thanks!

Sorry the wrong title, it seems that Safari on windows cut some text on
text fields. The title should be: “Partial not passing local variables”

On 27 Mar 2008, at 13:04, Henrique T. wrote:

But address in the partial is nil… shouldn’t the local variable
‘address’ be available in the partial? And why is it nil?

Did you mean to write render :partial => ‘address’, :object =>
@person.address ?

Fred

Frederick C. wrote:

On 27 Mar 2008, at 13:04, Henrique T. wrote:

But address in the partial is nil… shouldn’t the local variable
‘address’ be available in the partial? And why is it nil?

Did you mean to write render :partial => ‘address’, :object =>
@person.address ?

Fred

Doesn’t Rails Edge have this syntax? Now I am confusing… I saw this on
a ticket but now I can’t find it. The right partial is rendered,
although the local variable ‘address’ is nil.

Anyway, using :object works fine, thanks!

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs