'How do I initialize a database with one instance of a model in RoR?
I have a personal portfolio written in RoR, and in it is an "about" page. This "about" page pulls its text from an Info model. In other words, I do not want my about page to be a static file. I want to be able to edit its contents.
This raises a concern. I should have exactly one instance of the Info model in the database as this will be the model displayed on the webpage. It should not be possible to create or delete Info models as, again, there should only be one.
How can I ensure that there will only be one instance of this model? How can I have the database "start" with one instance of this model?
Is there a way to add an instance of the Info model into the database whenever it is reset?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
