wheels 0.0.31 → 0.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/app/controllers/blogs_controller.rb +1 -1
- data/app/models/role.rb +16 -4
- data/app/models/user.rb +5 -1
- data/wheels.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.0.
|
|
1
|
+
0.0.32
|
|
@@ -10,7 +10,7 @@ class BlogsController < InheritedResources::Base
|
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def begin_of_association_chain
|
|
13
|
-
@user ||= (current_user
|
|
13
|
+
@user ||= (current_user || User.root)
|
|
14
14
|
@tags = Blog.where(:user_id=>@user.id).tag_counts.sort{|t, u| t.count <=> u.count}
|
|
15
15
|
return @user
|
|
16
16
|
end
|
data/app/models/role.rb
CHANGED
|
@@ -2,6 +2,22 @@ class Role < ActiveRecord::Base
|
|
|
2
2
|
has_many :users
|
|
3
3
|
has_many :access_control_entries
|
|
4
4
|
|
|
5
|
+
def self.root
|
|
6
|
+
@root ||= find_by_name("Super")
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
def self.nobody
|
|
10
|
+
@nobody ||= find_by_name("Nobody")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.user
|
|
14
|
+
@user ||= find_by_name("User")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.admin
|
|
18
|
+
@admin ||= find_by_name("Admin")
|
|
19
|
+
end
|
|
20
|
+
|
|
5
21
|
def self.collection_entries
|
|
6
22
|
roles = [["Not Set", nil]]
|
|
7
23
|
Role.all.map{|t| [t.name, t.id]}.each do |t|
|
|
@@ -9,9 +25,5 @@ class Role < ActiveRecord::Base
|
|
|
9
25
|
end
|
|
10
26
|
roles
|
|
11
27
|
end
|
|
12
|
-
|
|
13
|
-
SUPER = 1
|
|
14
|
-
ADMIN = 2
|
|
15
|
-
USER = 3
|
|
16
28
|
end
|
|
17
29
|
|
data/app/models/user.rb
CHANGED
|
@@ -7,7 +7,11 @@ class User < ActiveRecord::Base
|
|
|
7
7
|
has_many :access_control_entries, :dependent=>:destroy
|
|
8
8
|
|
|
9
9
|
def self.nobody
|
|
10
|
-
User.new(:role=>
|
|
10
|
+
User.new(:role=>Role.nobody)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def self.root
|
|
14
|
+
User.where(:role_id=>Role.root.id)
|
|
11
15
|
end
|
|
12
16
|
|
|
13
17
|
def create_profile
|
data/wheels.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: wheels
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 95
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 0
|
|
9
|
-
-
|
|
10
|
-
version: 0.0.
|
|
9
|
+
- 32
|
|
10
|
+
version: 0.0.32
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Tyler Gannon
|