Это сводит меня с ума. У меня есть новое Rails 3.2.2
приложение для управления активами.
Вот мой контроллер:
class AssetsController < ApplicationController
respond_to :html, :json, :xml
def index
respond_with(@assets = Asset.all)
end
def show
@asset = Asset.find(params[:id])
respond_with @asset
end
def new
@asset = Asset.new
respond_with @asset
end
def create
@asset = Asset.new(params[:asset])
if @asset.save
flash[:notice] = "Asset created successfully"
end
respond_with @asset
end
def edit
@asset = Asset.find(params[:id])
respond_with @asset
end
def update
@asset = Asset.find(params[:id])
if @asset.update_attributes(params[:asset])
flash[:notice] = "Asset updated successfully"
end
respond_with @asset
end
def destroy
# tbd...
end
end
Вот часть моего application.html.erb
<% flash.each do |name, msg| %>
<div class="alert alert-<%= name == :notice ? "success" : "error" %>">
<%= msg %>
</div>
<% end %>
Однако вспышка всегда пуста. Даже после успешного обновления модели ресурса.
Когда я отлаживаю объект flash, я получаю следующее:
--- !ruby/object:ActionDispatch::Flash::FlashHash
used: !ruby/object:Set
hash: {}
closed: false
flashes: {}
now:
Что я делаю не так?