我意识到以下几点:
user1 = User.create - creates a model with id 1 and age is 0
same_user = User.find(1)
same_user.update_attributes(:age => 18)
p same_user.age # prints out 18
p user1.age # prints out 0
为什么现有属性不从数据库中获取值?
我意识到以下几点:
user1 = User.create - creates a model with id 1 and age is 0
same_user = User.find(1)
same_user.update_attributes(:age => 18)
p same_user.age # prints out 18
p user1.age # prints out 0
为什么现有属性不从数据库中获取值?