开发者

Help modifying a Model in RoR? What happens to existing records?

开发者 https://www.devze.com 2023-03-17 23:58 出处:网络
I\'m trying to modify an existing Ruby on Rails project. I understand that forms and models are closely 开发者_高级运维related. I\'m trying to understand how to modify a form so that instead of accept

I'm trying to modify an existing Ruby on Rails project. I understand that forms and models are closely 开发者_高级运维related. I'm trying to understand how to modify a form so that instead of accepting an upload, it stores a timestamp instead. So, my understanding is that I need to modify the view and the model. Is there anything else I need to modify? What happens to existing data that I have stored in ActiveRecord?


Unless you remove columns from the table with a new migration - data will be safe. It's a good practice to write tests, so when such situations occur that you need to modify something - you can test that everything still works.

Btw, I don't understand the logic that you are trying to implement. The form was uploading some file before, and you need to change that and remove the file upload and modify some timestamp in the record?


Your existing data is supposed to be fixed up with a migration, which you will need to write.

0

精彩评论

暂无评论...
验证码 换一张
取 消