File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 1
1
class User < ActiveRecord ::Base
2
+ validates :name , :presence => true , :uniqueness => true
3
+
4
+ validates :password , :confirmation => true
5
+ attr_accessor :password_confirmation
6
+ attr_reader :password
7
+
8
+ validate :password_must_be_present
9
+
10
+ private
11
+ def password_must_be_present
12
+ errors . add ( :password , "Missing password" ) unless hashed_password . present?
13
+ end
2
14
end
Original file line number Diff line number Diff line change 10
10
#
11
11
# It's strongly recommended to check this file into your version control system.
12
12
13
- ActiveRecord ::Schema . define ( :version => 20110403043457 ) do
13
+ ActiveRecord ::Schema . define ( :version => 20110403122207 ) do
14
14
15
15
create_table "carts" , :force => true do |t |
16
16
t . datetime "created_at"
44
44
t . datetime "updated_at"
45
45
end
46
46
47
+ create_table "users" , :force => true do |t |
48
+ t . string "name"
49
+ t . string "hashed_password"
50
+ t . string "salt"
51
+ t . datetime "created_at"
52
+ t . datetime "updated_at"
53
+ end
54
+
47
55
end
You can’t perform that action at this time.
0 commit comments