2

I have two roles option in my registration page seller and buyer i was using the seed.rb file for this but know i changed the names to seller and customer and pushed it to heroku by doing

heroku run rake:db seed

Everything worked well but now on my registration page am getting four roles options seller, buyer, Seller, Customer I want only the Seller And Customer one what should i do

my seed.rb

['Customer', 'Seller'].each do |role|
  Role.find_or_create_by({name: role})
end
Ahmed Reza Siddique
  • 383
  • 1
  • 6
  • 20

1 Answers1

2

You can connect to the rails console on heroku with:

heruko run rails c

You can then delete the rows one by one with:

Role.find_by!(name: 'buyer').destroy!

Or delete all the roles not matching a whitelist:

Role.where.not(name: ['Seller', 'Customer']).destroy_all
Deepak Mahakale
  • 22,834
  • 10
  • 68
  • 88
max
  • 96,212
  • 14
  • 104
  • 165
  • If you are getting an error such as `bash: heroku: command not found` make sure you have installed the Heruko CLI - https://devcenter.heroku.com/articles/heroku-command-line – max Sep 30 '16 at 14:48