underscore_params 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -1
- data/lib/underscore_params/version.rb +1 -1
- data/underscore_params.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: beeb530843827ee44142190bf7af0b0d360f3a4e
|
4
|
+
data.tar.gz: 5676fd09e988430486f6cdf737a1bbfa1d172256
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d67f4ae38ef76adb3fe1707d92f7fd091ad46e972a80dbceab7b26e49ecd58548787abfaa62904e9c03a6dace671a894c5117bc390a9f380f365f2352b56739
|
7
|
+
data.tar.gz: 522fe6b3085b4165080c5dc8caa240defd03d4eecab7aa965c4b72c4e985851a80320da3338184ce0ebc0f1157820d2e33b50cd6164759148345dc72376c4ac8
|
data/README.md
CHANGED
@@ -8,6 +8,18 @@ Will underscore all param keys including deeply nested ones.
|
|
8
8
|
|
9
9
|
Helpful if you do not have control over the view layer / what params are being sent to the application and don't want to complicate controllers / models with conversion logic.
|
10
10
|
|
11
|
+
Many javascript apps / scripts have the convention of their model attributes to be written using [camelCase](http://en.wikipedia.org/wiki/CamelCase) while ruby prefers the [snake_case](http://en.wikipedia.org/wiki/Snake_case) convention. This gem helps smooth out the inconsistency.
|
12
|
+
|
13
|
+
So instead of doing this in controllers:
|
14
|
+
|
15
|
+
params[:objectName] || params[:object_name]
|
16
|
+
|
17
|
+
it can be simply
|
18
|
+
|
19
|
+
params[:object_name]
|
20
|
+
|
21
|
+
regardless of what format the client sends
|
22
|
+
|
11
23
|
## Installation
|
12
24
|
|
13
25
|
Add this line to your application's Gemfile:
|
@@ -25,7 +37,7 @@ Or install it yourself as:
|
|
25
37
|
## Usage
|
26
38
|
|
27
39
|
* Just reference in Gemfile
|
28
|
-
* Works for Rails 4+ (not tested on earlier versions)
|
40
|
+
* Works for Rails 4+ (not tested on earlier versions). YMMV.
|
29
41
|
|
30
42
|
## Contributing
|
31
43
|
|
data/underscore_params.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["ansonkelly@gmail.com"]
|
11
11
|
spec.summary = %q{Forces all rails request params to be underscored.}
|
12
12
|
spec.description = %q{Forces all rails request params (both GET and POST) to be underscored.}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/ansonK/underscore_params"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: underscore_params
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anson Kelly
|
@@ -41,7 +41,7 @@ files:
|
|
41
41
|
- lib/underscore_params/version.rb
|
42
42
|
- test/underscore_params_test.rb
|
43
43
|
- underscore_params.gemspec
|
44
|
-
homepage:
|
44
|
+
homepage: https://github.com/ansonK/underscore_params
|
45
45
|
licenses:
|
46
46
|
- MIT
|
47
47
|
metadata: {}
|