// using Rails 2.3.5
//routes.rb
map.resources :users,
>> user = User.first
>> helper.link_to user.name, user
I am getting nil error. I thought the above code should work. What am I missing?
The problem is that link_to
uses url_for
which needs an incoming url host. You can use app.url_for
in the console to fake it like so:
helper.link_to user.name, app.url_for(user)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With