Hirohito Yamada Hirohito Yamada - 5 months ago 7
Ruby Question

friendlyId won't work correctly

Im trying to apply friendlyId gem onto my rails app.

When I have done

1 : installing gem,
2 : and this

bin/rails g friendly_id
create db/migrate/20150220082838_create_friendly_id_slugs.rb
create config/initializers/friendly_id.rb

bin/rake db:migrate

db:migrate runs okay but when I go rails s, I get the following message

Migrations are pending. To resolve this issue, run:

bin/rake db:migrate RAILS_ENV=development

include FriendlyId
friendly_id :account

Then when I do bin/rake db:migrate RAILS_ENV=development, console returns this error

PG::DuplicateTable: ERROR: relation "friendly_id_slugs" already exists

I've tried dropping db but it just gives more more problems to solve(since I already have users data in my development.)

and when I google it, same issues reported in github page is already been solved by the bug fix and it won't give me a hint for me to solve it..

How could I get this to work properly???
Thank you for your time.


Following solved my problem...!

bundle exec rake db:reset