我通過邁克爾·哈特爾的Rails的教程工作,當我運行我的測試套件,我看到了這樣的錯誤:棄用警告(哈特爾教程)
DEPRECATION WARNING: You attempted to assign a value which is not explicitly
`true` or `false` to a boolean column. Currently this value casts to `false`.
This will change to match Ruby's semantics, and will cast to `true` in Rails
5. If you would like to maintain the current behavior, you should explicitly
handle the values you would like cast to `false`. (called from remember at
.../RoR_Tutorial/sample_app/app/models/user.rb:28)
DEPRECATION WARNING: You attempted to assign a value which is not explicitly
`true` or `false` to a boolean column. Currently this value casts to `false`.
This will change to match Ruby's semantics, and will cast to `true` in Rails
5. If you would like to maintain the current behavior, you should explicitly
handle the values you would like cast to `false`. (called from update at
...RoR_Tutorial/sample_app/app/controllers/users_controller.rb:40)
這似乎是憤怒的電話到update_attribute
像這樣:
def remember
self.remember_token = User.new_token
update_attribute(:remember_digest, User.digest(remember_token))
end
或
def update
@user = User.find(params[:id])
if @user.update_attributes(user_params)
flash[:success] = 'Profile Updated'
redirect_to @user
else
render 'edit'
end
end
...任何人都可以澄清這個警告試圖告訴我什麼?