wheels 0.0.44 → 0.0.45

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.44
1
+ 0.0.45
@@ -5,7 +5,6 @@ class UsersController < InheritedResources::Base
5
5
  before_filter :authenticate_user!, :resource
6
6
 
7
7
  def edit
8
- resource.old_password
9
8
  respond_with(resource)
10
9
  end
11
10
 
@@ -20,11 +19,7 @@ class UsersController < InheritedResources::Base
20
19
  end
21
20
 
22
21
  def resource
23
- @user ||= lambda{
24
- user = User.find(current_user)
25
- user.extend(PasswordValidators)
26
- user
27
- }.call
22
+ @user ||= FullyValidatedUser.find(current_user)
28
23
  end
29
24
  end
30
25
 
data/app/models/user.rb CHANGED
@@ -6,16 +6,6 @@ class User < ActiveRecord::Base
6
6
  has_many :galleries, :dependent => :destroy
7
7
  has_many :access_control_entries, :dependent=>:destroy
8
8
 
9
- validates :email, :presence => true
10
-
11
- def validates_password
12
- class_eval do
13
- attr_accessor :old_password
14
- validates :old_password, :presence=>true , :password=>true
15
- validates :password, :presence=>true , :length=>{:minimum=>6}
16
- validates :password_confirmation, :equal_to=>{:other=>:password}
17
- end
18
- end
19
9
 
20
10
  def self.nobody
21
11
  User.new(:role=>Role.nobody)
@@ -60,3 +50,11 @@ class User < ActiveRecord::Base
60
50
 
61
51
  end
62
52
 
53
+ class FullyValidatedUser < User
54
+ attr_accessor :old_password
55
+ validates :email, :presence => true, :email => true
56
+ validates :old_password, :presence=>true , :password=>true
57
+ validates :password, :presence=>true , :length=>{:minimum=>6}
58
+ validates :password_confirmation, :equal_to=>{:other=>:password}
59
+ end
60
+
@@ -1,5 +1,5 @@
1
1
  module PasswordValidators
2
- def self.extended(base)
2
+ def self.included(base)
3
3
  attr_accessor :old_password
4
4
  validates :old_password, :presence=>true , :password=>true
5
5
  validates :password, :presence=>true , :length=>{:minimum=>6}
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.44"
8
+ s.version = "0.0.45"
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
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 44
9
- version: 0.0.44
8
+ - 45
9
+ version: 0.0.45
10
10
  platform: ruby
11
11
  authors:
12
12
  - Tyler Gannon