permissable 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.2.3
data/lib/permissable.rb CHANGED
@@ -27,8 +27,8 @@ module Permissable
27
27
 
28
28
  # Creates a hash from a resource to be used in a where context.
29
29
  def flatten_resource(obj)
30
- return { :resource_id => obj.id, :resource_type => obj.base_class.to_s } unless obj.is_a?(Array)
31
- { :resource_id => obj.collect{ |o| o.id }, :resource_type => obj.collect{ |o| o.base_class.to_s } }
30
+ return { :resource_id => obj.id, :resource_type => (obj.respond_to?(:base_class) ? obj.base_class.to_s : obj.class.base_class.to_s) } unless obj.is_a?(Array)
31
+ { :resource_id => obj.collect{ |o| o.id }, :resource_type => obj.collect{ |o| (o.respond_to?(:base_class) ? o.base_class.to_s : o.class.base_class.to_s) } }
32
32
  end
33
33
 
34
34
  end
@@ -134,7 +134,7 @@ module Permissable
134
134
 
135
135
  def fetch_scope(resource)
136
136
  return resource if resource.is_a?(String)
137
- (resource.is_a?(Class)) ? resource.to_s : resource.base_class.to_s.classify
137
+ (resource.respond_to? :base_class) ? resource.base_class.to_s : resource.class.base_class.to_s.classify
138
138
  end
139
139
 
140
140
  # Look to see if we have a permissions cache.
data/permissable.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{permissable}
8
- s.version = "0.2.2"
8
+ s.version = "0.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brent Kirby"]
12
- s.date = %q{2010-09-05}
12
+ s.date = %q{2010-09-07}
13
13
  s.description = %q{Permissable lets you set a number of 'permissions' to your database models. By assigning 'members' to 'resources' (models) you can specify various permission states.}
14
14
  s.email = %q{brent@kurbmedia.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: permissable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 2
10
- version: 0.2.2
9
+ - 3
10
+ version: 0.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brent Kirby
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-05 00:00:00 -04:00
18
+ date: 2010-09-07 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency