I don’t know what is up, but I was experimenting with GSUB then decided I didn’t want to use it anymore so changed my link_to arguments back to:
<%= link_to root_url(@user.username), @user.username %>
Now I keep getting this error:
undefined method `gsub’ for nil:NilClass
and when I remove that whole line from my show file everything is fine.
or if I change it to this:
<%= link_to root_url(:user => @user.username), @user.username %>
It’s like it has been confused some how and thinks I’m still using the gsub method when I’m not. I’ve tested or url helpers such as login, password_reset etc and they all work fine. It seems to only be doing this with root_url.
I also cloned a repo of my site from yesterday before I got this issue and guess what?
Same error..
I’ve never been this frustrated with my programming.
Is there something I can clear? I’ve tried clearing everything inthe tmp folder still no luck.
routes:
Mysite::Application.routes.draw do
resources :users
resources :sessions
resources :passwords
root :to => "users#new"
match 'success' => "users#success"
match 'login' => "sessions#new"
match 'logout' => "sessions#destroy"
match 'reset_password' => "passwords#new"
match 'setup_new_password' => "passwords#edit"
match ':username' => "users#show"
end
This should do the trick, as root_url (and root_path) do not have parameters:
<%= link_to @user.username, root_url %>