tuning 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e26655041f082469be05f8a721a507d9e67be6e4
4
- data.tar.gz: eae31ff42e6e539df0d88fc90d0ef19f67236e91
3
+ metadata.gz: d5789c96633959f77bfaa6da1dc4fb9f17d3a12f
4
+ data.tar.gz: 3975a6588670a9a5e64ebace6b696ec21956027f
5
5
  SHA512:
6
- metadata.gz: 07f9823d485a2e21e1566c47115372ef8772b8e396d694a51ea52bad56b557f266032b026bc2aebeb30cca05481f3573a80d9722326b77877127450689157b90
7
- data.tar.gz: 0951e9316e1b6536b39b0b09e14638017c9153a8cc3aac8fd80bc6454a6bf098dba06f10d76a44e0d8641041acbc3ae05cc01f9ef0b71b0f0df699180a80f261
6
+ metadata.gz: 7d20e603a0d6fa880551fe99d5115735686c1d52e77f36a13c10c6645d3766ef3853dda25f02cf58483de0379c02e8b8202e2afbf68414454cfc09f84039ff90
7
+ data.tar.gz: ecad167e71dc891f4cf8ff05ab8c64b46ddc0fec79c993fefbb5e82fe55c6e000909a5f0ce5fe7c0676d68271bf98443b527047c1dbdf81ae486d6b3d0ac47c3
@@ -4,7 +4,7 @@ module Tuning
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- rescue_from Exception, with: :error if Rails.env == 'development'
7
+ rescue_from Exception, with: :error if Rails.env.development?
8
8
  end
9
9
 
10
10
  protected
@@ -12,15 +12,38 @@ module Tuning
12
12
  def error(exception)
13
13
  logger.error exception.message
14
14
  exception.backtrace.each { |line| logger.error line }
15
- render file: Rails.root.join('public', '500.html'), status: 500, layout: false
15
+ respond_to do |format|
16
+ format.json { head 500 }
17
+ format.any { render file: Rails.root.join('public', '500.html'), status: 500, layout: false }
18
+ end
16
19
  end
17
20
 
18
21
  def not_found
19
- render file: Rails.root.join('public', '404.html'), status: 404, layout: false
22
+ respond_to do |format|
23
+ format.json { head 404 }
24
+ format.any { render file: Rails.root.join('public', '404.html'), status: 404, layout: false }
25
+ end
20
26
  end
21
27
 
28
+ def unauthorized
29
+ respond_to do |format|
30
+ format.json { head 401 }
31
+ format.any { render file: Rails.root.join('public', '422.html'), status: 401, layout: false }
32
+ end
33
+ end
34
+
22
35
  def forbidden
23
- render file: Rails.root.join('public', '422.html'), status: 422, layout: false
36
+ respond_to do |format|
37
+ format.json { head 403 }
38
+ format.any { render file: Rails.root.join('public', '422.html'), status: 403, layout: false }
39
+ end
40
+ end
41
+
42
+ def unprocessable_entity
43
+ respond_to do |format|
44
+ format.json { head 422 }
45
+ format.any { render file: Rails.root.join('public', '422.html'), status: 422, layout: false }
46
+ end
24
47
  end
25
48
 
26
49
  end
@@ -1,5 +1,5 @@
1
1
  module Tuning
2
2
 
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tuning
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mattways
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-21 00:00:00.000000000 Z
11
+ date: 2013-12-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  requirements: []
112
112
  rubyforge_project:
113
- rubygems_version: 2.0.3
113
+ rubygems_version: 2.1.11
114
114
  signing_key:
115
115
  specification_version: 4
116
116
  summary: Tuning for Rails.