Last Updated: February 25, 2016
·
1.573K
· hidakatsuya

Use UrlHelper in rails console

$ rails c
> helper.link_to 'foo', 'hoge'
  => "<a href=\"hoge\">foo</a>" 
> app.url_for(controller: 'articles', action: 'new')
  => "http://www.example.com/articles/new"
> app.new_article_path
  => "/articles/new"

2 Responses
Add your response

i tried it with Rails 3.2.11 . Its throwing error
NoMethodError: undefined method `url_for' for nil:NilClass

over 1 year ago ·

Thank you! Has been fixed. Please use the app instead of the helper.

over 1 year ago ·