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 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.create_from_params(params)
29
+ Message.new_from_params(params)
29
30
 
30
31
  Also you can update an existing instance:
31
32
 
data/lib/accessitude.rb CHANGED
@@ -45,7 +45,7 @@ module Accessitude
45
45
  end
46
46
 
47
47
  # Create a new instance only using attr_accessible params
48
- def create_from_params(params)
48
+ def new_from_params(params)
49
49
  self.create( params.slice(*accessitude_attrs) )
50
50
  end
51
51
 
@@ -14,5 +14,5 @@
14
14
  # the License.
15
15
 
16
16
  module Accessitude
17
- VERSION = "0.0.2"
17
+ VERSION = "0.0.3"
18
18
  end
@@ -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.create_from_params(params)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: accessitude
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: