Sha256: 04fa67a21f334f146f05d3e64ee0c7e861d3f67bbe6d5b43524f42b774ae0eff

Contents?: true

Size: 604 Bytes

Versions: 17

Compression:

Stored size: 604 Bytes

Contents

# Basically a standard responder, but if 
module Edifice
  class Responder < ActionController::Responder
  protected 
    # add the :u_e header to xhr error requests
    def to_html
      if controller.request.xhr? && !get? and has_errors? && default_action
        render :action => default_action, :status => :unprocessable_entity, :layout => nil
      else
        super
      end
    end
    
    # actually render something on successful updates
    def to_format
      unless get? or has_errors? or post?
        display resource, :status => :ok
      else
        super
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
edifice-0.10.3 lib/edifice/responder.rb
edifice-0.10.2 lib/edifice/responder.rb
edifice-0.10.1 lib/edifice/responder.rb
edifice-0.10.0 lib/edifice/responder.rb
edifice-0.9.0 lib/edifice/responder.rb
edifice-0.8.0 lib/edifice/responder.rb
edifice-0.7.3 lib/edifice/responder.rb
edifice-0.7.2 lib/edifice/responder.rb
edifice-0.7.1 lib/edifice/responder.rb
edifice-0.7.0 lib/edifice/responder.rb
edifice-0.6.9 lib/edifice/responder.rb
edifice-0.6.8 lib/edifice/responder.rb
edifice-0.6.7 lib/edifice/responder.rb
edifice-0.6.6 lib/edifice/responder.rb
edifice-0.6.5 lib/edifice/responder.rb
edifice-0.6.4 lib/edifice/responder.rb
edifice-0.6.3 lib/edifice/responder.rb