Rails friendly_id不会在heroku上的现有用户上呈现 [英] Rails friendly_id doesn't render on existing user on heroku

查看:190
本文介绍了Rails friendly_id不会在heroku上的现有用户上呈现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 friendly_id gem让我的网址更加友好,例如,在URL中用用户名替换id。一切正常,正在开发中,因为我即将运行(更新current users url):

$ p $ User.find_each(&:save) 在我的rails c。



但是在生产模式下,在heroku上,它仅适用于新用户 - 如何将friendly_id模型添加到现有用户?



我试图运行

  Heroku run rake Pin .find_each(&保存)

但没有成功:

  -bash:接近意外标记的语法错误`('

任何想法如何解决这个问题?

解决方案

b

  heroku run console 

然后:

  Pin.find_each(&保存)


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?

解决方案

Inside your application directory:

heroku run console

And then:

Pin.find_each(&:save)

这篇关于Rails friendly_id不会在heroku上的现有用户上呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆