Following the rails guides' tutorial, I ran into an issue where I learnt about plural vs. singular naming and repercussions. Now that I know this going forward, I'm interested in learning if it's possible to work around this -- without having to rename my controller.
按照rails指南的教程,我遇到了一个问题,我学习了复数与单数命名和反响。现在我知道这一点,我有兴趣学习是否可以解决这个问题 - 无需重命名我的控制器。
I've passed a new :url_path to form_for (account_path) and my 'rake routes' outputs an entry:
我已经传递了一个新的:url_path到form_for(account_path),我的'rake routes'输出一个条目:
account GET /account/:id(.:format) account#show
I still get the following error when trying to access the page with the form:
尝试访问具有以下表单的页面时,仍会出现以下错误:
Routing Error
No route matches {:action=>"show", :controller=>"account"}
My routes.rb has an entry for the plural resources directory (resources :account)... Understanding that the singular version works, but the controller still represents "many".
我的routes.rb有一个复数资源目录的条目(资源:帐户)...了解奇异版本的工作原理,但控制器仍然代表“很多”。
Any insight for a green RoR dev?
对绿色RoR开发者的任何见解?
1 个解决方案
#1
0
Assuming it's not a typo - you should write resource :account
. Hope that helps.
假设它不是拼写错误 - 你应该写资源:帐户。希望有所帮助。
#1
0
Assuming it's not a typo - you should write resource :account
. Hope that helps.
假设它不是拼写错误 - 你应该写资源:帐户。希望有所帮助。