Rendering a partial with locals from applicat_helper

i have the following method in my application_helper.rb

def test
render(:partial => ‘/application/errors’, :locals => {
:detail_msgs => ‘testing…’,
:headline => [‘asd’, ‘wwww’],
:msgs => [‘adssaad’]})

when I call this within one of my views it does not recognize the locals
and it results in an error that the var does not exists. when i remove
the vars within the partial then its rendered fine … but i need the
locals there

i am using rails 2.0.1

thx for any help!

i took me quite a while to find the problem but finally i found the
“stupid” mistake … within the partial i used the locals as instance
vars instead of common vars …

so instead

<%= @headline %>

i use

<%= headline %>

yep … now i wont forget this for sure :slight_smile:


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