Reputation: 1856
I'm about to add in a few users manually (because I want to make them admins eg user.admin = true
. Previously, in development I've done this using seeds but I believe (correct me if I'm wrong) that you aren't supposed to use seeds in this way in production. What else should I do?
Upvotes: 0
Views: 78
Reputation: 1173
Do you have access to the production command line? If you're using Heroku you can do this:
$ heroku run rails console
> user = User.new
> user.name = "The name"
// repeat for all other fields
> user.admin = true
> user.save
Or if you already have them in the database as non-admins
$ heroku run rails console
> user = User.find_by(name: "Their Name")
> user.update_attribute(:admin, true)
Upvotes: 0
Reputation: 646
There are a number of options, each with their own pros and cons.
The best solution might be to add a script in the scripts/
directory of your app detailing the steps, have this code reviewed by your team, and then run it with rails runner
.
Upvotes: 2