* Rails 5 beta removes this interface
https://github.com/rails/rails/pull/18371
* Using protected over private so that subclasses of the including class
may still access these methods.
* Since these methods are called directly in test, we raise the access
modifier to public for them to preserve the test behavior.
First, trying to get param key for ActiveModel objects, as Rails' `form_for` helper uses it to generate key for parameters hash. See 9f44aa0863/actionview/lib/action_view/helpers/form_helper.rb (L433) for reference.
Second, allowing to redefine it with `param_key` option (as element in optional second argument hash), it is useful in case of single table inheritance, when the param key is differs from actual class (as it is getting defined at runtime).
And last, use previous behaviour otherwise.
Fixes https://github.com/elabs/pundit/issues/286
* Remove use of `Kernel#capture` to find RSpec deprecation warnings
because it has has been deprecated.
* Add `require "active_support"` to setup auto-loading.
Closes#252.
Before to namespace headless policy we needed to use following syntax:
authorize :'project/dashboard'
Now we can use array to specify each constant separately so it looks cleaner
authorize [:project, :dashboard]
Enables `policy(:dashboard) # => DashboardPolicy`.
Policies without a matching model can come in handy when a controller
isn't modeled alongside a resource, e.g. a `DashboardsController`.
The policy lookup by symbol also helps with strong parameters,
since I prefer `policy(:post)` or `policy(@post || :post)` over `policy(@post || Post)`.