elabs/pundit — pull request #141 by thomasklemm (2014-04-28 21:42:08+00:00)
Title: Add permitted_attributes helper

This PR adds a `permitted_attributes` helper. It wraps the current approach (of encouraging `PostPolicy#permitted_attributes` to return accessible attributes).

```ruby
def post_params
params.require(:post).permit(*policy_attributes(@post || :post))
end
```

I've tried wrapping things even further and returning some kind of strong params object, however this seems to be cleanest and nicest approach without bloating Pundit too much.

One "side effect" is that you can also pass policies as symbols, which allows policies without underlying models as suggested in #77: `authorize :dashboard, :show? # => DashboardPolicy#show?`

@jnicklas I'd highly value your opinion.