views:

53

answers:

1
// 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?

+1  A: 

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)
mckeed