test/rails31/app/controllers/flash_controller.rb in glow-0.0.12 vs test/rails31/app/controllers/flash_controller.rb in glow-0.0.13
- old
+ new
@@ -1,6 +1,9 @@
class FlashController < ApplicationController
+
+ headerize_flash_for :json
+
def show
# show.html.erb
end
def redirect
@@ -8,13 +11,15 @@
redirect_to action: 'show'
end
def ajax
respond_to do |wants|
- wants.js {
- flash[params[:type].to_sym] = params[:message]
- flash[:skip_glow] = params[:skip_glow].present?
- head :ok
- }
+ [:js, :json, :xml].each do |fmt|
+ wants.send(fmt) {
+ flash[params[:type].to_sym] = params[:message]
+ flash[:skip_glow] = params[:skip_glow].present?
+ head :ok
+ }
+ end
end
end
end