I have a Rails 4.1.6 application and use Devise for the 'user' model. The link to my sign in page works fine:
<%= link_to 'Sign in'.upcase, new_user_session_path %>
results in
<a href="/users/sign_in">SIGN IN</a>
However, adding a link to an action on another controller breaks the link to sign_in:
<%= link_to( 'GET STARTED', {controller: :contacts, action: :new}, method: :get) %>
<%= link_to 'Sign in'.upcase, new_user_session_path %>
still produces the same HTML:
<a data-method="get" href="/contacts/new">GET STARTED</a>
<a href="/users/sign_in">SIGN IN</a>
But, the 'SIGN IN' link no longer works, with this error:
ActionController::UrlGenerationError at /users/sign_in
No route matches {:action=>"new", :controller=>"devise/contacts"}
This answer is for a similar situation and tells me that 'Rails is looking for a partial scoped under Devise since this is the one under which you're rendering.' But, my scope understanding is weak and I'm still struggling with how to fix this.
# relevant portion of routes.rb:
devise_for :users, :controllers => { registrations: 'registrations' }
resources :users
match '/contacts/new', to: 'contacts#new', via: 'get'