params_for 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8cef79cc5641a6860e4df2ad3adb4ad2fd1fa42
4
- data.tar.gz: 240969f6a63bd4e3a9a7376d0ab7e2458dcc6ae5
3
+ metadata.gz: f50940ab4624d6cd23e6dd00b9832eb6bf6ac84b
4
+ data.tar.gz: 6c753dfd7f65181ac38ce94c4bfe65ff45d51d58
5
5
  SHA512:
6
- metadata.gz: 122bea292a672b722ad98fabdfe7d59cf48e9e8f463334d888db18b434840bdeb4623115903c9340cb679499832540f12d695e282cfbf983a494698a9f7fc6ce
7
- data.tar.gz: 70e50ac65ff040047f015a73ab05557a4f1938887b2b15611e09b0cf670da61795d7b0a0a2e18e7842214af9e5b19fbd07ed6d9778a7ea3dcbe60d11fd57063c
6
+ metadata.gz: c08bf888c09cd157f189f67803d70cf7f829e3c8bf8c72f94bc4e446827a5afbe5355cad2c226a5263885f8441ac9760c6398548d5674236fb853b2037b143f1
7
+ data.tar.gz: 538ca50039f6e9c22e40a8088eb5d9c6a0ce304c1758729f06b6c6779928060ab7b6fac615b2417a96dafc5ff14b1997b56d43b2dd26a87197a2a7bd1f5a7111
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ before_install: gem install bundler -v 1.7
3
+ script: "bundle exec rspec ./spec"
4
+ rvm:
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - 2.1.2
data/README.md CHANGED
@@ -1,10 +1,13 @@
1
+ [![Build
2
+ Status](https://travis-ci.org/andresbravog/params_for.svg)](https://travis-ci.org/andresbravog/params_for) [![Code Climate](https://codeclimate.com/github/andresbravog/params_for/badges/gpa.svg)](https://codeclimate.com/github/andresbravog/params_for) [![Test Coverage](https://codeclimate.com/github/andresbravog/params_for/badges/coverage.svg)](https://codeclimate.com/github/andresbravog/params_for) [![Inline docs](http://inch-ci.org/github/andresbravog/params_for.svg?branch=master)](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 Fancycontroller < ApplicationController
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 Fancycontroller < ApplicationController
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 ParamValidator::Fancy
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/param_validator/fancy.rb
80
+ # app/validators/params_for/fancy.rb
78
81
 
79
- class ParamValidator::Fancy < ParamValidator::Base
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
@@ -54,7 +54,7 @@ module ParamsFor
54
54
  #
55
55
  # @return [Boolean]
56
56
  def attribute?(key)
57
- self.class.instance_methods.include? key.to_sym
57
+ self.class.attributes.include? key.to_sym
58
58
  end
59
59
 
60
60
  # Return the attributes of the validator filtered by
@@ -1,3 +1,3 @@
1
1
  module ParamsFor
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -1,5 +1,3 @@
1
- # require "codeclimate-test-reporter"
2
- # CodeClimate::TestReporter.start
3
1
 
4
2
  $LOAD_PATH.unshift(File.dirname(__FILE__))
5
3
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
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.2
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-19 00:00:00.000000000 Z
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.4.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.