问题
I am using the friendly_id gem to make my url friendly & replace id by username in the url for example. Everything works fine under development, because I was about to run (to update currents users url):
User.find_each(&:save)
in my rails c.
But in production mode, on heroku, It works only with new users - How can I add the friendly_id models to existing users ?
I tried to run
Heroku run rake Pin.find_each(&:save)
But without success:
-bash: syntax error near unexpected token `('
Any ideas how I can fix this?
回答1:
Inside your application directory:
heroku run console
And then:
Pin.find_each(&:save)
来源:https://stackoverflow.com/questions/24682282/rails-friendly-id-doesnt-render-on-existing-user-on-heroku