I am working on a rails app, which is getting upgraded from rails(3.0.9) to rails (3.2.22). I will try to demonstrate the problem through a demo rails app.
I created demo app's for different rails versions. I have something like this inside.
class ApplicationController < ActionController::Base
protect_from_forgery
layout :select_layout
def select_layout
@tmp = 'tmp variable'
@layout = 'application'
end
end
And accessing @tmp inside layouts/application.html.erb :-
<!DOCTYPE html>
<html>
<head>
<title>TwistageScopeIssue</title>
<%= stylesheet_link_tag "application", :media => "all" %>
<%= javascript_include_tag "application" %>
<%= csrf_meta_tags %>
</head>
<body>
<%= yield %> <br/>
<%= @tmp %> <br/>
</body>
</html>
Values(@tmp) displays correctly('tmp variable') in : 3.0.x and 3.1.x .
Values(@tmp) gets set to nil : 3.2.x onwards
I am still looking into the rails source code to get some information, meanwhile any thoughts/idea's would be really helpful.
Thanks
Aucun commentaire:
Enregistrer un commentaire