Render :partial stops setting local variables


#1

I’m not sure what happened, or what change has caused this to happen,
but
render :partial (or any render for that matter, doesn’t seem to let me
set
local variables via the local_assigns argument hash.

for example

<%= render :partial ‘edit’, :username => @user.username %>

used to allow that username was a local variable in my _edit.rhtml
partial
template.
example:

Username: <%= username %>

Could this be a problem with Ruby 1.8.4?


Sean W.
master nerd of
i heart squares, Co.

3711 N. Ravenswood Ave. #147 Chicago, IL 60613
Ph. (773) 531-6301 Fx. (773) 529-7041
http://www.iheartsquares.com


#2

On 1/3/06, Sean W. removed_email_address@domain.invalid wrote:

Could this be a problem with Ruby 1.8.4?

Tried it on Ruby 1.8.2 and it still fails… Is there soem sort of
environment setting that controls how varaibles get passed in the render
method? This used to work fine, yestrday, but suddenly today, on all my
machines this stopped working.

Any help or insight would be greatly appreciated.


Sean W.
master nerd of
i heart squares, Co.

3711 N. Ravenswood Ave. #147 Chicago, IL 60613
Ph. (773) 531-6301 Fx. (773) 529-7041
http://www.iheartsquares.com


#3

On 1/3/06, Sean W. removed_email_address@domain.invalid wrote:

I’m not sure what happened, or what change has caused this to happen, but
render :partial (or any render for that matter, doesn’t seem to let me set
local variables via the local_assigns argument hash.

for example

<%= render :partial ‘edit’, :username => @user.username %>

I believe you want:

<%= render :partial ‘edit’, :locals => {:username => @user.username} %>


#4

On 1/3/06, Lance B. removed_email_address@domain.invalid wrote:

I believe you want:

<%= render :partial ‘edit’, :locals => {:username => @user.username} %>

Ahhh thanks… Thats it!

I take it that api.rubyonrails.com isn’t up to date.
http://api.rubyonrails.com/classes/ActionView/Base.html#M000468
show this still
render(options = {}, old_local_assigns = {})

I also tried the previous way containing the two hash arguments in curly
braces, it still ignored the local assigns.

I just wonder why this was working fine before, and then suddenly
stopped
working?


Sean W.
master nerd of
i heart squares, Co.

3711 N. Ravenswood Ave. #147 Chicago, IL 60613
Ph. (773) 531-6301 Fx. (773) 529-7041
http://www.iheartsquares.com