consul 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of consul might be problematic. Click here for more details.

data/Gemfile CHANGED
@@ -6,3 +6,4 @@ gem 'rspec', '=1.3.1'
6
6
  gem 'rspec-rails', '=1.3.3'
7
7
  gem 'jeweler'
8
8
  gem 'ruby-debug'
9
+ gem 'sqlite3-ruby'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{consul}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Henning Koch"]
12
- s.date = %q{2011-04-13}
12
+ s.date = %q{2011-07-07}
13
13
  s.description = %q{Consul is a scope-based authorization solution for Ruby on Rails.}
14
14
  s.email = %q{henning.koch@makandra.de}
15
15
  s.extra_rdoc_files = [
@@ -61,38 +61,37 @@ Gem::Specification.new do |s|
61
61
  s.homepage = %q{http://github.com/makandra/consul}
62
62
  s.rdoc_options = ["--charset=UTF-8"]
63
63
  s.require_paths = ["lib"]
64
- s.rubygems_version = %q{1.3.7}
64
+ s.rubygems_version = %q{1.7.2}
65
65
  s.summary = %q{Scope-based authorization solution for Rails}
66
66
  s.test_files = [
67
- "spec/app_root/db/migrate/001_create_users.rb",
68
- "spec/app_root/db/migrate/002_create_clients.rb",
69
- "spec/app_root/db/migrate/003_create_notes.rb",
70
- "spec/app_root/config/boot.rb",
71
- "spec/app_root/config/environment.rb",
72
- "spec/app_root/config/environments/in_memory.rb",
73
- "spec/app_root/config/environments/mysql.rb",
74
- "spec/app_root/config/environments/postgresql.rb",
75
- "spec/app_root/config/environments/sqlite.rb",
76
- "spec/app_root/config/environments/sqlite3.rb",
77
- "spec/app_root/config/routes.rb",
78
- "spec/app_root/lib/console_with_fixtures.rb",
67
+ "spec/controllers/users_controller_spec.rb",
68
+ "spec/controllers/songs_controller_spec.rb",
69
+ "spec/controllers/dashboards_controller_spec.rb",
70
+ "spec/spec_helper.rb",
71
+ "spec/consul/power_spec.rb",
72
+ "spec/app_root/app/controllers/songs_controller.rb",
79
73
  "spec/app_root/app/controllers/dashboards_controller.rb",
80
74
  "spec/app_root/app/controllers/application_controller.rb",
81
75
  "spec/app_root/app/controllers/users_controller.rb",
82
- "spec/app_root/app/controllers/songs_controller.rb",
83
76
  "spec/app_root/app/models/client.rb",
84
- "spec/app_root/app/models/note.rb",
85
- "spec/app_root/app/models/user.rb",
86
77
  "spec/app_root/app/models/power.rb",
87
- "spec/consul/power_spec.rb",
88
- "spec/spec_helper.rb",
89
- "spec/controllers/users_controller_spec.rb",
90
- "spec/controllers/dashboards_controller_spec.rb",
91
- "spec/controllers/songs_controller_spec.rb"
78
+ "spec/app_root/app/models/user.rb",
79
+ "spec/app_root/app/models/note.rb",
80
+ "spec/app_root/lib/console_with_fixtures.rb",
81
+ "spec/app_root/config/boot.rb",
82
+ "spec/app_root/config/routes.rb",
83
+ "spec/app_root/config/environments/mysql.rb",
84
+ "spec/app_root/config/environments/sqlite3.rb",
85
+ "spec/app_root/config/environments/in_memory.rb",
86
+ "spec/app_root/config/environments/postgresql.rb",
87
+ "spec/app_root/config/environments/sqlite.rb",
88
+ "spec/app_root/config/environment.rb",
89
+ "spec/app_root/db/migrate/001_create_users.rb",
90
+ "spec/app_root/db/migrate/002_create_clients.rb",
91
+ "spec/app_root/db/migrate/003_create_notes.rb"
92
92
  ]
93
93
 
94
94
  if s.respond_to? :specification_version then
95
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
96
95
  s.specification_version = 3
97
96
 
98
97
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -37,7 +37,11 @@ module Consul
37
37
  define_method("#{name.to_s.singularize}?") { |*args| include?(name, *args) }
38
38
  define_method("#{name.to_s.singularize}!") { |*args| include!(name, *args) }
39
39
  ids_method = power_ids_name(name)
40
- define_method(ids_method) { |*args| send(name, *args).scoped(:select => 'id').collect(&:id) }
40
+ define_method(ids_method) do |*args|
41
+ scope = send(name, *args)
42
+ scope_ids = scope.scoped(:select => "`#{scope.table_name}`.`id`")
43
+ scope_ids.collect(&:id)
44
+ end
41
45
  memoize ids_method
42
46
  name
43
47
  end
@@ -4,10 +4,4 @@ class Client < ActiveRecord::Base
4
4
 
5
5
  named_scope :active, :conditions => ["deleted = ? OR deleted IS NULL", false]
6
6
 
7
- def foo
8
- with_scope do
9
-
10
- end
11
- end
12
-
13
7
  end
@@ -13,6 +13,10 @@ class Power
13
13
  client.notes
14
14
  end
15
15
 
16
+ power :notes do
17
+ Note.scoped(:joins => :client)
18
+ end
19
+
16
20
  power :admin do
17
21
  false
18
22
  end
@@ -45,6 +45,10 @@ describe Consul::Power do
45
45
  2.times { @user.power.client_ids }
46
46
  end
47
47
 
48
+ it 'should return ids when the scope joins another table (bugfix)' do
49
+ expect { @user.power.note_ids }.to_not raise_error
50
+ end
51
+
48
52
  end
49
53
 
50
54
  describe 'include?' do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
5
- prerelease: false
4
+ hash: 31
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Henning Koch
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-13 00:00:00 +02:00
19
- default_executable:
18
+ date: 2011-07-07 00:00:00 Z
20
19
  dependencies: []
21
20
 
22
21
  description: Consul is a scope-based authorization solution for Ruby on Rails.
@@ -69,7 +68,6 @@ files:
69
68
  - spec/rcov.opts
70
69
  - spec/spec.opts
71
70
  - spec/spec_helper.rb
72
- has_rdoc: true
73
71
  homepage: http://github.com/makandra/consul
74
72
  licenses: []
75
73
 
@@ -99,33 +97,33 @@ required_rubygems_version: !ruby/object:Gem::Requirement
99
97
  requirements: []
100
98
 
101
99
  rubyforge_project:
102
- rubygems_version: 1.3.7
100
+ rubygems_version: 1.7.2
103
101
  signing_key:
104
102
  specification_version: 3
105
103
  summary: Scope-based authorization solution for Rails
106
104
  test_files:
107
- - spec/app_root/db/migrate/001_create_users.rb
108
- - spec/app_root/db/migrate/002_create_clients.rb
109
- - spec/app_root/db/migrate/003_create_notes.rb
110
- - spec/app_root/config/boot.rb
111
- - spec/app_root/config/environment.rb
112
- - spec/app_root/config/environments/in_memory.rb
113
- - spec/app_root/config/environments/mysql.rb
114
- - spec/app_root/config/environments/postgresql.rb
115
- - spec/app_root/config/environments/sqlite.rb
116
- - spec/app_root/config/environments/sqlite3.rb
117
- - spec/app_root/config/routes.rb
118
- - spec/app_root/lib/console_with_fixtures.rb
105
+ - spec/controllers/users_controller_spec.rb
106
+ - spec/controllers/songs_controller_spec.rb
107
+ - spec/controllers/dashboards_controller_spec.rb
108
+ - spec/spec_helper.rb
109
+ - spec/consul/power_spec.rb
110
+ - spec/app_root/app/controllers/songs_controller.rb
119
111
  - spec/app_root/app/controllers/dashboards_controller.rb
120
112
  - spec/app_root/app/controllers/application_controller.rb
121
113
  - spec/app_root/app/controllers/users_controller.rb
122
- - spec/app_root/app/controllers/songs_controller.rb
123
114
  - spec/app_root/app/models/client.rb
124
- - spec/app_root/app/models/note.rb
125
- - spec/app_root/app/models/user.rb
126
115
  - spec/app_root/app/models/power.rb
127
- - spec/consul/power_spec.rb
128
- - spec/spec_helper.rb
129
- - spec/controllers/users_controller_spec.rb
130
- - spec/controllers/dashboards_controller_spec.rb
131
- - spec/controllers/songs_controller_spec.rb
116
+ - spec/app_root/app/models/user.rb
117
+ - spec/app_root/app/models/note.rb
118
+ - spec/app_root/lib/console_with_fixtures.rb
119
+ - spec/app_root/config/boot.rb
120
+ - spec/app_root/config/routes.rb
121
+ - spec/app_root/config/environments/mysql.rb
122
+ - spec/app_root/config/environments/sqlite3.rb
123
+ - spec/app_root/config/environments/in_memory.rb
124
+ - spec/app_root/config/environments/postgresql.rb
125
+ - spec/app_root/config/environments/sqlite.rb
126
+ - spec/app_root/config/environment.rb
127
+ - spec/app_root/db/migrate/001_create_users.rb
128
+ - spec/app_root/db/migrate/002_create_clients.rb
129
+ - spec/app_root/db/migrate/003_create_notes.rb