authority 2.4.0 → 2.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.markdown CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  Authority does its best to use [semantic versioning](http://semver.org).
4
4
 
5
+ ## v2.4.1
6
+
7
+ The controller method name given to `authorize_actions_for` no longer has to be public. (We don't want to force controllers to make any method public that shouldn't be a routable action.)
8
+
5
9
  ## v2.4.0
6
10
 
7
11
  Controller method `authorize_actions_for` can now be given a method name to dynamically determine the class to authorize. For example, `authorize_actions_for :model_class` will call the `model_class` method on the controller instance at request time.
data/README.markdown CHANGED
@@ -377,7 +377,7 @@ class LlamasController < ApplicationController
377
377
  authorize_actions_for :llama_class
378
378
 
379
379
  def llama_class
380
- [StandardLlama, LludicriousLlama].sample
380
+ [StandardLlama, LludicrousLlama].sample
381
381
  end
382
382
  end
383
383
  ```
@@ -96,7 +96,8 @@ module Authority
96
96
 
97
97
  def authority_resource
98
98
  return self.class.authority_resource if self.class.authority_resource.is_a?(Class)
99
- return send(self.class.authority_resource) if respond_to?(self.class.authority_resource)
99
+ send(self.class.authority_resource)
100
+ rescue NoMethodError => e
100
101
  raise MissingResource.new(
101
102
  "Trying to authorize actions for '#{self.class.authority_resource}', but can't. \
102
103
  Must be either a resource class OR the name of a controller instance method that \
@@ -1,3 +1,3 @@
1
1
  module Authority
2
- VERSION = "2.4.0"
2
+ VERSION = "2.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authority
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-13 00:00:00.000000000 Z
13
+ date: 2013-02-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
89
  version: '0'
90
90
  segments:
91
91
  - 0
92
- hash: -37039868613240694
92
+ hash: 1265936513199133765
93
93
  required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  version: '0'
99
99
  segments:
100
100
  - 0
101
- hash: -37039868613240694
101
+ hash: 1265936513199133765
102
102
  requirements: []
103
103
  rubyforge_project:
104
104
  rubygems_version: 1.8.24