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"
Written by Katsuya Hidaka
Related protips
2 Responses
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Related Tags
#rails
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#