Rails friendly_id doesn't render on existing user on heroku

こ雲淡風輕ζ 提交于 2020-01-07 08:24:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!