rescue-dog 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
  [![Gem Version](https://badge.fury.io/rb/rescue-dog.png)](http://badge.fury.io/rb/rescue-dog)
3
3
  [![Coverage Status](https://coveralls.io/repos/yulii/rescue-dog/badge.png?branch=master)](https://coveralls.io/r/yulii/rescue-dog)
4
4
  [![Build Status](https://travis-ci.org/yulii/rescue-dog.png)](https://travis-ci.org/yulii/rescue-dog)
5
+ [![Dependency Status](https://gemnasium.com/yulii/rescue-dog.png)](https://gemnasium.com/yulii/rescue-dog)
5
6
 
6
- The Rescue-Dog responds HTTP status (the code and message) when raise the exception.
7
+ The Rescue-Dog responds HTTP status (the code and message) when raises the exception for Rails.
7
8
 
8
9
  ## Installation
9
10
 
@@ -34,10 +35,6 @@ $ gem install rescue-dog
34
35
  ### Render Static Files
35
36
  Render /public/400(.:format) if you raise BadRequest exception.
36
37
 
37
- ```bash
38
- $ vim app/controllers/application_controller.rb
39
- ```
40
-
41
38
  ```ruby
42
39
  class ApplicationController
43
40
 
@@ -51,10 +48,6 @@ class ApplicationController
51
48
  ### Render Template
52
49
  Render app/views/errors/404(.:format) if you raise NotFound exception.
53
50
 
54
- ```bash
55
- $ vim app/controllers/application_controller.rb
56
- ```
57
-
58
51
  ```ruby
59
52
  class ApplicationController
60
53
 
@@ -80,6 +73,27 @@ rescue_associate ActiveRecord::RecordNotFound ,with: 404
80
73
  rescue_associate Mongoid::Errors::DocumentNotFound, BSON::InvalidObjectId, with: 404
81
74
  ```
82
75
 
76
+ Learn more usage, check [`spec`](https://github.com/yulii/rescue-dog/blob/master/spec/rails_spec_app.rb)
77
+
78
+ ### Respond Application Error Codes
79
+ 1. Include `Rescue::Controller::Dynamic` (NOT `Rescue::Controller::Static`).
80
+ 2. Include `Rescue::RespondError`
81
+ 3. Raise the exception (cf. [`Rescue::ApplicationError::STATUS_CODES`](https://github.com/yulii/rescue-dog/blob/master/lib/rescue/exceptions/application_error.rb))
82
+
83
+ ```ruby
84
+ class ApplicationController
85
+ include Rescue::Controller::Dynamic
86
+ include Rescue::RespondError
87
+ ```
88
+
89
+ #### Suppress HTTP Response Codes
90
+ All responses will be returned with a 200 OK status code, even if the error occurs.
91
+ ```ruby
92
+ Rescue.configure do |config|
93
+ config.suppress_response_codes = true
94
+ end
95
+ ```
96
+
83
97
  ## Contributing
84
98
 
85
99
  1. Fork it
@@ -1,3 +1,3 @@
1
1
  module Rescue
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/rescue-dog.gemspec CHANGED
@@ -17,5 +17,5 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency "rails", "~>3.2.11"
20
+ gem.add_dependency 'rails', '>= 3.2.11'
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rescue-dog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,14 +9,14 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-05-01 00:00:00.000000000 Z
12
+ date: 2013-06-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ~>
19
+ - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
21
  version: 3.2.11
22
22
  type: :runtime
@@ -24,7 +24,7 @@ dependencies:
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ~>
27
+ - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
29
  version: 3.2.11
30
30
  description: respond to an exception raised in Rails