リダイレクト後にビューに 2 つの文字列を渡したい。コントローラー:
def create
@rating = Rating.new(params[:rating])
respond_to do |format|
if @rating.save
format.html { redirect_to @rating, :notice => 'Got It!' ,
:notice_small => 'Your photo has been uploaded. good luck with it\'s coolness rating!' }
format.json { render :json => @rating, :status => :created, :location => @rating }
else
format.html { render :action => "new" }
format.json { render :json => @rating.errors, :status => :unprocessable_entity }
end
end
end
景色:
<p id="notice" class="big_notice"><%= notice %></p>
<% if defined? notice_small %>
<p id="small_notice" class="small_notice"><%= notice_small %></p>
<% end %>
通知文字列はスローされますが、notice_small はスローされません。なぜですか?