I want to ask a question
- Is there a way to register records at the migration stage?
is
I am creating a web application with a user management system with rails
Therefore, there is a problem that cannot be solved for the part that manages the user's place of residence.
The user registers the address at the new registration stage, but for prefectures, I would like to register it in a separate column because it may be used independently within the service.
So, I would like to take the form of selecting only 47 prefectures from the pull-down list at the time of registration, but I am worried about whether to describe all 47 prefectures on the front side or create a prefecture table.
If i leave the processing to the front side, the amount of description will increase, so I think that it is a good idea to consider future function implementation.
However, when I create a table, I'm not sure how to add records for each prefecture when deploying to a production environment.
I would like to have a method to automatically add records when migrating at the time of deployment, but I would like to know if there is such a method.
Also, I would be grateful if you could tell me how to manage prefectures in web applications in general.
-
Answer # 1
Related articles
- ruby on rails - how to manage good images with git in rails projects
- ruby - i want to know where to install rails gem and how to manage it
- ruby - the last db setting doesn't work when deploying rails app on aws
- ruby on rails - i want to implement a function for administrator users to register luggage for general users in rails
- ruby on rails - things associated with a foreign key cannot be called in view
- ruby on rails 6 - environment construction of ruby on rails
- ruby on rails 5 - actioncontroller :: invalidauthenticitytoken cannot be resolved
- ruby on rails - error in controller when transitioning with rails6 destory action
- ruby on rails - access fails after seed after deploying to heroku
- ruby on rails runtime error cannot be resolved
- ruby on rails 5 - some items are not saved in db when posting from rails form
- ruby on rails - missing required keys: i'm having trouble resolving the [: id] error
- ruby on rails - rails s can't
- bootstrap display in ruby on rails is broken
- ruby - [rails] i can't install the add favorite button
- ruby on rails - dealing with wrong number of arguments (given 1, expected 2)
- ruby on rails - seed fails on heroku
- ruby on rails - cannot pass id to destroy action of intermediate table
- ruby on rails - i want to post an image by dragging and dropping
- mysql - i'm having trouble getting the name of the person who posted the message to appear in the view
- ruby - rails db: migrate is not possible
- ruby - for example, how to create a crawler that wants to get information from tabelog
- ruby on rails - i want to display a list of liked data
- html - data cannot be acquired or displayed with parameters
- postgresql - unable to resolve error in db: create
- i want to set the primary key to any column ruby migration file
- ruby - cannot save to database
- ruby on rails uninitialized constant error
Ichiou, you can mix it with migration, but the initial data isseedBut write it somewhere else
bin/rake db: seed
It is common to input with a command like.