Forum: Ruby on Rails render :partial stops setting local variables.

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.
8f15d89f469605e9e07a8b5ce5d3d5d1?d=identicon&s=25 Sean Wolfe (Guest)
on 2006-01-03 22:31
(Received via mailing list)
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:

<p><b>Username:</b> <%= username %></p>

Could this be a problem with Ruby 1.8.4?


--
Sean Wolfe
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
8f15d89f469605e9e07a8b5ce5d3d5d1?d=identicon&s=25 Sean Wolfe (Guest)
on 2006-01-03 22:53
(Received via mailing list)
On 1/3/06, Sean Wolfe <sean@iheartsquares.com> 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 Wolfe
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
D046cca1a33655b6285065ec89711389?d=identicon&s=25 Lance Ball (Guest)
on 2006-01-03 22:56
(Received via mailing list)
On 1/3/06, Sean Wolfe <sean@iheartsquares.com> 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} %>
8f15d89f469605e9e07a8b5ce5d3d5d1?d=identicon&s=25 Sean Wolfe (Guest)
on 2006-01-04 20:06
(Received via mailing list)
On 1/3/06, Lance Ball <lanceball@gmail.com> 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...
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 Wolfe
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
This topic is locked and can not be replied to.