wheels 0.0.31 → 0.0.32

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.31
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 ? User.find(current_user.id) : super_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=>"Nobody")
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
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wheels}
8
- s.version = "0.0.31"
8
+ s.version = "0.0.32"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tyler Gannon"]
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: 33
4
+ hash: 95
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 31
10
- version: 0.0.31
9
+ - 32
10
+ version: 0.0.32
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tyler Gannon