accessitude 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -2
- data/lib/accessitude.rb +1 -1
- data/lib/accessitude/version.rb +1 -1
- data/spec/accessitude_spec.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -2,7 +2,8 @@
|
|
2
2
|
|
3
3
|
### Don't tell me what params I need, I will tell you!
|
4
4
|
|
5
|
-
A helper for Rails that will select only accessible parameters to be passed to a Model.
|
5
|
+
A helper for Rails that will select only accessible parameters to be passed to a Model. This is useful for frameworks like _Angularjs_, which will pass all attributes in a request when only a select few should be accessible to the model.
|
6
|
+
|
6
7
|
|
7
8
|
https://github.com/mguymon/accessitude
|
8
9
|
|
@@ -25,7 +26,7 @@ Now add to models that you want to have `Accessitude`:
|
|
25
26
|
|
26
27
|
Now you can create a new instance in a Controller and simply pass in the entire `param` hash. Accessitude will only select params that have been set in the model's `attr_accessible`:
|
27
28
|
|
28
|
-
Message.
|
29
|
+
Message.new_from_params(params)
|
29
30
|
|
30
31
|
Also you can update an existing instance:
|
31
32
|
|
data/lib/accessitude.rb
CHANGED
data/lib/accessitude/version.rb
CHANGED
data/spec/accessitude_spec.rb
CHANGED
@@ -59,7 +59,7 @@ describe Accessitude do
|
|
59
59
|
|
60
60
|
it "should create using accessitude attributes" do
|
61
61
|
params = {"one" => "one", "two" => "two", "title" => "title", "body" => "body", "hamster"=>"not set"}
|
62
|
-
instance = subject.
|
62
|
+
instance = subject.new_from_params(params)
|
63
63
|
instance.title.should eql "title"
|
64
64
|
instance.body.should eql "body"
|
65
65
|
instance.desc.should be_nil
|