开发者

URL Helper - undefined method

rake routes:

api_v1_accounts GET    /api/v1/accounts(.:format)      {:action=>"index", :controller=>"api/v1/accounts"}

That means I should have a url helper method:

api_v1_accounts_url

I am trying to test creating an account with rspec and the following line fails:

route = api_v1_accounts_url(account)

Saying t开发者_JS百科hat api_v1_accounts_url is an undefined method

I guess I've really misunderstood something about URL helper methods and the scope of them. Please help


include Rails.application.routes.url_helpers

That did the trick

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜