Skip to content

Commit

Permalink
user concern method format + readme notes
Browse files Browse the repository at this point in the history
  • Loading branch information
michelson committed May 15, 2018
1 parent e09bdd1 commit e7e6495
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ When the policies are configured will generate some helper methods on User model

**Use this in your controller:**
```ruby
@user.store_policy_cookie if cookies["policy_rule_cookie"] == "accepted"
@user.accept_policy_from("your_cookie") if cookies["policy_rule_your_cookie"] == "accepted"
```
+ **validates_on:** will require users validation, will automagically create virtual attributes for the policy you set, so, if you set `age` in your config you must supply in your forms a `policy_rule_age` checkbox in your form, if you don't supply those then the user validation will return errors on `policy_rule_age` . Don't forget to add the fields in your strong params in the controller which handles the request.
+ **if:** you can add conditions as a Proc in order skip validations:
Expand Down
3 changes: 1 addition & 2 deletions app/models/policy_manager/concerns/user_behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ def portability_member_for(rule)
end

def portability_collection_for(rule, page = nil)
collection = self.send(rule.collection)
.paginate(page: page, per_page: rule.per)
self.send(rule.collection).paginate(page: page, per_page: rule.per)
end

def pending_policies
Expand Down

0 comments on commit e7e6495

Please sign in to comment.