这是我的User模型.rb。
我想添加一个新的密码列。 我使用了以下命令:
在Rails控制台中:不能在新的User对象中添加密码,即不能在新的数据库条目中添加密码。请建议。 附言:我是Rails的新手,所以这可能是一个愚蠢的问题。我正在使用Rails版本:3.2.13和Ruby版本:1.9.3
class User < ActiveRecord::Base
attr_accessor :password
attr_accessible :email, :name
validates :name,:presence=>true,:length=>{:maximum=>15}
validates :email,:presence=>true,:length=>{:maximum=>15}
end
我想添加一个新的密码列。 我使用了以下命令:
rails g migration pass_mig password:string
那么
rake db:migrate
但在数据库架构中仍然存在
ActiveRecord::Schema.define(:version => 20130627073430) do
create_table "users", :force => true do |t|
t.string "name"
t.string "email"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
end
在Rails控制台中:不能在新的User对象中添加密码,即不能在新的数据库条目中添加密码。请建议。 附言:我是Rails的新手,所以这可能是一个愚蠢的问题。我正在使用Rails版本:3.2.13和Ruby版本:1.9.3