Leonardo Mateo wrote: > On Mon, Oct 26, 2009 at 12:35 PM, Max Williams > <rails-mailing-l...@andreas-s.net> wrote: >> �rescue_from ActionController::RoutingError, :with => :bad_url >> >> %> in one of my views. �I can see with logging that the any_exception >> method is called, and it does render the errors/index page. �However, on >> the page, @message is nil - it's like it's got lost somewhere between >> being set and being used. �Can anyone see what i'm doing wrong? >> > You should pass the variable with the locals parameter. > render :template => "errors/index", :layout => "v4-2col-paranoid", > :locals => {:message => @message} > > And in the view, refer to it as message. > > Hope it helps. > -- > Leonardo Mateo. > There's no place like ~
Ah.. I thought that was just for partials. If i set an instance var and then call render :template in a regular controller action, then it works fine. Is the behaviour different when you call render from a private controller method than when you call it from a regular action? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---