写出来的都是shit,快关闭!

运行rake Db:seed ,添加devise User

新建 project/db/seeds.rb

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
email     = "1@qq.com"
password  = "12345678"

p "---begin---"

account = User.create(:email => email, :password => password, :password_confirmation => password)

if account.valid?
  p "================================================================="
  p "Account has been successfully created, now you can login with:"
  p "================================================================="
  p "   email: #{email}"
  p "   password: #{password}"
  p "================================================================="
else
  p "Sorry but some thing went wrong!"
  p ""
  account.errors.full_messages.each { |m| shell.say "   - #{m}" }
end

p "---end---"

然后运行:

1
rake db:seed