Sha256: 633eb1bc0eb4c27e8535e38e4d23f7c95223ed61f3cb2c901da1e1a0a082f8f4

Contents?: true

Size: 395 Bytes

Versions: 9

Compression:

Stored size: 395 Bytes

Contents

# http://stackoverflow.com/questions/9953887
module Responders::JsonResponder
  protected

  # simply render the resource even on POST instead of redirecting for ajax
  def api_behavior
    if post?
      display resource, :status => :created
    # render resource instead of 204 no content
    elsif put? || delete?
      display resource, :status => :ok
    else
      super
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lazy_crud-0.9.8.4 lib/responders/json_responder.rb
lazy_crud-0.9.8.3 lib/responders/json_responder.rb
lazy_crud-0.9.8.2 lib/responders/json_responder.rb
lazy_crud-0.9.8.1 lib/responders/json_responder.rb
lazy_crud-0.9.8.0 lib/responders/json_responder.rb
lazy_crud-0.9.7.1 lib/responders/json_responder.rb
lazy_crud-0.9.7 lib/responders/json_responder.rb
lazy_crud-0.9.6 lib/responders/json_responder.rb
lazy_crud-0.9.5 lib/responders/json_responder.rb