Ruby on Railsを使ってプログラムを書いているのですが、コントローラーにおける変数のスコープについて質問があります。
class HogehogeController < ApplicationController def index @name = "bar" end def show @hogehoge = "foo" + @name end end
として、show.html.erbで
<%= @hogehoge %>
としたのですが、
no implicit conversion of nil into String
のようなエラーが出てしまって困っています。
どなたかわかる方いたらよろしくお願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/28 03:00
退会済みユーザー
2018/09/28 03:08
2018/09/28 03:10