1
0
Fork 0
mirror of https://github.com/varvet/pundit.git synced 2022-11-09 12:30:11 -05:00
Commit graph

10 commits

Author SHA1 Message Date
Jonas Nicklas and Kim Burgestrand
52f42cf6a5 Merge branch 'namespaced-headless-policies' of https://github.com/techery/pundit into techery-namespaced-headless-policies 2015-03-26 10:03:11 +01:00
Eduardo Gutierrez
8ee11ef2fc Fix tests on ActiveSupport v4.2.x
* 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.
2015-03-10 09:31:04 -04:00
Sergey Stupachenko
9711b4896b Add array-based syntax for namespaced headless policies
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]
2014-10-11 16:05:10 +03:00
Jonas Nicklas
753bb0a2b6 Revert namespaces 2014-08-22 11:19:36 +02:00
Jonas Nicklas
9d578a0a2d Make sure Pundit doesn’t generate any deprecation warnings with any version of RSpec 2014-07-18 16:20:48 +02:00
Jonas Nicklas
1942db052b Merge pull request #168 from elabs/headless-policies
Enable headless policies
2014-07-17 11:31:37 +02:00
Unknown_Guy
bf29cae128 find correct policy when model is namespaced 2014-07-15 13:08:08 +03:00
Thomas Klemm
b18d16ca10 Enable headless policies
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)`.
2014-07-13 12:48:45 +02:00
Eduardo Gutierrez
4c7d3c4dd6 Lookup policies in the current namespace
Addresses #12. If the policy is not defined in `namespace`, `const_get`
will search through the inheritance change of `namespace` to find the
policy.
2014-05-22 12:55:34 -04:00
Dillon Benson
30b7861431 moved class definitions from pundit_spec.rb to spec_helper.rb 2014-04-23 22:58:38 -04:00