params_for 0.0.2 → 0.0.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 +4 -4
- data/.travis.yml +7 -0
- data/README.md +9 -6
- data/lib/params_for/base.rb +1 -1
- data/lib/params_for/version.rb +1 -1
- data/spec/spec_helper.rb +0 -2
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f50940ab4624d6cd23e6dd00b9832eb6bf6ac84b
|
4
|
+
data.tar.gz: 6c753dfd7f65181ac38ce94c4bfe65ff45d51d58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c08bf888c09cd157f189f67803d70cf7f829e3c8bf8c72f94bc4e446827a5afbe5355cad2c226a5263885f8441ac9760c6398548d5674236fb853b2037b143f1
|
7
|
+
data.tar.gz: 538ca50039f6e9c22e40a8088eb5d9c6a0ce304c1758729f06b6c6779928060ab7b6fac615b2417a96dafc5ff14b1997b56d43b2dd26a87197a2a7bd1f5a7111
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,10 +1,13 @@
|
|
1
|
+
[](https://travis-ci.org/andresbravog/params_for) [](https://codeclimate.com/github/andresbravog/params_for) [](https://codeclimate.com/github/andresbravog/params_for) [](http://inch-ci.org/github/andresbravog/params_for)
|
3
|
+
|
1
4
|
# ParamsFor
|
2
5
|
|
3
6
|
Use service objects and the power of `ActiveModel::Validations` to easy validate params in controller.
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
7
|
-
Add this line to your application's Gemfile
|
10
|
+
Add this line to your application's `Gemfile`:
|
8
11
|
|
9
12
|
```ruby
|
10
13
|
gem 'params_for'
|
@@ -26,7 +29,7 @@ In your controller:
|
|
26
29
|
```Ruby
|
27
30
|
# app/controllers/fancy_controller.rb
|
28
31
|
|
29
|
-
class
|
32
|
+
class FancyController < ApplicationController
|
30
33
|
include ParamsFor::Connectors::Glue
|
31
34
|
|
32
35
|
params_for :fancy, only: [:create]
|
@@ -47,7 +50,7 @@ Or you can play with it yourself
|
|
47
50
|
```Ruby
|
48
51
|
# app/controllers/fancy_controller.rb
|
49
52
|
|
50
|
-
class
|
53
|
+
class FancyController < ApplicationController
|
51
54
|
include ParamsFor::Connectors::Glue
|
52
55
|
|
53
56
|
# Creates a Fancy object by checking and validating params
|
@@ -61,7 +64,7 @@ class Fancycontroller < ApplicationController
|
|
61
64
|
|
62
65
|
protected
|
63
66
|
|
64
|
-
# Strong params delegated to
|
67
|
+
# Strong params delegated to ParamsFor::Fancy
|
65
68
|
# and memoized in @fancy_params var returned by this method
|
66
69
|
#
|
67
70
|
# @return [HashwithIndifferentAccess]
|
@@ -74,9 +77,9 @@ end
|
|
74
77
|
Some place in your application ( suggested `app/validators/params_for/` )
|
75
78
|
|
76
79
|
```Ruby
|
77
|
-
# app/validators/
|
80
|
+
# app/validators/params_for/fancy.rb
|
78
81
|
|
79
|
-
class
|
82
|
+
class ParamsFor::Fancy < ParamsFor::Base
|
80
83
|
attr_accessor :user_id, :fancy_name, :fancy_description
|
81
84
|
|
82
85
|
validates :user_id, :fancy_name, presence: true
|
data/lib/params_for/base.rb
CHANGED
data/lib/params_for/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: params_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- andresbravog
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -132,6 +132,7 @@ extensions: []
|
|
132
132
|
extra_rdoc_files: []
|
133
133
|
files:
|
134
134
|
- ".gitignore"
|
135
|
+
- ".travis.yml"
|
135
136
|
- Gemfile
|
136
137
|
- LICENSE.txt
|
137
138
|
- README.md
|
@@ -165,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
166
|
version: '0'
|
166
167
|
requirements: []
|
167
168
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.
|
169
|
+
rubygems_version: 2.2.2
|
169
170
|
signing_key:
|
170
171
|
specification_version: 4
|
171
172
|
summary: Params Validatior for controllers using active_model validations.
|