私はApplicationControllerにRailsのAplicationControllerトラブル
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
$banner = Banner.first
$template = Template.first
end
と私の_myfile.html.erbで
<%= $template.mainpage_benefits.html_safe %>
でそれを持っている私の端末は、次のエラーが発生しました:
ActionView::Template::Error (undefined method `html_safe' for nil:NilClass
私はドン」 before($ template = Template.first)。 、私はそれが
'raw'メソッドを使用しようとしました – uzaif
なぜ' $ template'の代わりに '@ template'を使用しないのですか? – uzaif