weak_parameters 0.1.2 → 0.1.3

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: 26e7c722507f3503ec86ccf9125412e4ffa92d80
4
- data.tar.gz: 2d12877fdf00a549ef15a33c3586d14b88dcc71e
3
+ metadata.gz: e2729c50cf6a7bf575ece702332a9c49777844d2
4
+ data.tar.gz: d0a8b974f3ec852ac01ad7b5e0cc9a2693235297
5
5
  SHA512:
6
- metadata.gz: 618f2b0a8f715c18636238b4e279a0cef462098313a2b5fac7fda66aa6c54df3d292a67b75c4c76e8f98af7bb10cf105f14204cc02791f3f3af1c18e0063617e
7
- data.tar.gz: 551e7ebf28056014418d229c41a9ac10b285fe8e30bc356a08b9f1b2a42f7336539f0672f3b440d2d08f09cd70796bd650162317cc2b8eb6abc7761bb0a93a86
6
+ metadata.gz: 83dd640de0cd2d2eda683ac2c5d96b0dc995e678dbc11f248c0f787af5e33bb8332faad2c791d2293ddf55738d68cea669b12a5e464657f96d5afd74ee26294b
7
+ data.tar.gz: cc89b87958e71b96427ff27360d4a5c396b8eb5d4a088b89893352bdbc171c541a2239e9c2879c4276a95e534d76689222007bd97613f7fc5eadabee080051b1
data/CHANGELOG.md ADDED
@@ -0,0 +1,40 @@
1
+ ## 0.1.3
2
+ * Don't directly touch AC::Base, but do it via AS.on_load
3
+
4
+ ## 0.1.2
5
+ * Add `:handler` option to customize failure behavior
6
+ * Fix bug around `float` validator with block
7
+
8
+ ## 0.1.1
9
+ * Add `any` validator
10
+
11
+ ## 0.1.0
12
+ * Add type checking to `string` validator
13
+
14
+ ## 0.0.9
15
+ * Improve error message
16
+
17
+ ## 0.0.8
18
+ * Add block support to all validators
19
+ * Add `float` validator
20
+
21
+ ## 0.0.7
22
+ * Fix `integer` validator bug
23
+
24
+ ## 0.0.6
25
+ * Change value handling in `:only` & `:except` checking
26
+
27
+ ## 0.0.5
28
+ * Add `:only` & `:except` options
29
+
30
+ ## 0.0.4
31
+ * Fix stored controller name for namespaced controller
32
+
33
+ ## 0.0.3
34
+ * Fix type name bug
35
+
36
+ ## 0.0.2
37
+ * Add `hash` & `boolean` validator
38
+
39
+ ## 0.0.1
40
+ * Release the first version on 2013-06-07
data/README.md CHANGED
@@ -8,6 +8,16 @@ gem "weak_parameters"
8
8
 
9
9
  ## Usage
10
10
  ```ruby
11
+ class ApplicationController < ActionController::Base
12
+ protect_from_forgery
13
+
14
+ respond_to :json
15
+
16
+ rescue_from WeakParameters::ValidationError do
17
+ head 400
18
+ end
19
+ end
20
+
11
21
  # WeakParameters provides `validates` class method to define validations.
12
22
  class RecipesController < ApplicationController
13
23
  validates :create do
@@ -46,6 +56,12 @@ irb(main):005:0> app.post "/recipes", name: "alice", type: "bob"
46
56
  * string
47
57
  * boolean (= 0, 1, false, true)
48
58
 
59
+ ### Avilable options
60
+ * required
61
+ * only
62
+ * except
63
+ * handler
64
+
49
65
  ## Tips
50
66
  WeakParameters.stats returns its validation metadata, and this is useful for auto-generating API documents.
51
67
  With [autodoc](https://github.com/r7kamura/autodoc), you can auto-generate API documents with params information.
@@ -1,3 +1,3 @@
1
1
  module WeakParameters
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -49,6 +49,12 @@ module WeakParameters
49
49
  hash[key] = ActiveSupport::HashWithIndifferentAccess.new
50
50
  end
51
51
  end
52
- end
53
52
 
54
- ActionController::Base.extend WeakParameters::Controller
53
+ class Railties < ::Rails::Railtie
54
+ initializer 'weak_parameters' do
55
+ ActiveSupport.on_load :action_controller do
56
+ ActionController::Base.extend WeakParameters::Controller
57
+ end
58
+ end
59
+ end
60
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: weak_parameters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-23 00:00:00.000000000 Z
11
+ date: 2014-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -74,6 +74,7 @@ extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
76
  - .gitignore
77
+ - CHANGELOG.md
77
78
  - Gemfile
78
79
  - LICENSE.txt
79
80
  - README.md