Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6913709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:15:09+00:00 2026-05-27T09:15:09+00:00

I am using Devise in an app for the first time and I am

  • 0

I am using Devise in an app for the first time and I am having a weird problem I cant understand:

I’ve created my User model with Devise, and setup all the registration, user sign-up, etc, and everything works fine. In my application header, I have my nav menu (which is currently empty) and a partial with log in, sign out, etc:

_header.html.erb

<div class='topbar'>
    <div class='container'>
        <%= link_to 'My app', root_path, :class => 'brand' %>
        <div class='nav'>
        </div>
        <%= render 'layouts/user_options' %>
    </div>
</div>

_user_options.html.erb

<ul class='user-options'>
    <% if user_signed_in? %>
      <li><%= link_to "Signed in as #{current_user.username}", '#' %></li>
      <li><%= link_to "Sign out", destroy_user_session_path, :method => :delete %></li>
    <% else %>
      <li><%= link_to "Sign up", new_user_registration_path %></li>
      <li><%= link_to "Sign in", new_user_session_path %></li>
    <% end %>
</ul>

Now I am adding the first link to the nav menu, if I use:

<%= link_to 'Tasks', '/tasks/index'  %>

Everything is fine. BUT if I use:

<%= link_to 'Tasks', :controller => 'tasks', :action => 'index'  %>

When I click on any of the Devise links, such as ‘Sign in’, I get 'No route matches {:controller=>"devise/tasks"}'

By request on the comments, here is the output of rake routes:
Tasks: TOP => routes => environment
(See full trace by running task with –trace)
MacBook-Pro-de-o:dearsherpa Oscar$ bundle exec rake routes

             tasks_index GET    /tasks/index(.:format)         {:controller=>"tasks", :action=>"index"}
              tasks_show GET    /tasks/show(.:format)          {:controller=>"tasks", :action=>"show"}
        new_user_session GET    /users/sign_in(.:format)       {:action=>"new", :controller=>"devise/sessions"}
            user_session POST   /users/sign_in(.:format)       {:action=>"create", :controller=>"devise/sessions"}
    destroy_user_session DELETE /users/sign_out(.:format)      {:action=>"destroy", :controller=>"devise/sessions"}
           user_password POST   /users/password(.:format)      {:action=>"create", :controller=>"devise/passwords"}
       new_user_password GET    /users/password/new(.:format)  {:action=>"new", :controller=>"devise/passwords"}
      edit_user_password GET    /users/password/edit(.:format) {:action=>"edit", :controller=>"devise/passwords"}
                         PUT    /users/password(.:format)      {:action=>"update", :controller=>"devise/passwords"}
cancel_user_registration GET    /users/cancel(.:format)        {:action=>"cancel", :controller=>"devise/registrations"}
       user_registration POST   /users(.:format)               {:action=>"create", :controller=>"devise/registrations"}
   new_user_registration GET    /users/sign_up(.:format)       {:action=>"new", :controller=>"devise/registrations"}
  edit_user_registration GET    /users/edit(.:format)          {:action=>"edit", :controller=>"devise/registrations"}
                         PUT    /users(.:format)               {:action=>"update", :controller=>"devise/registrations"}
                         DELETE /users(.:format)               {:action=>"destroy", :controller=>"devise/registrations"}
                    root        /                              {:controller=>"pages", :action=>"home"

and here is routes.rb:

  get "tasks/index"

  get "tasks/show"

  devise_for :users

  root :to => 'pages#home'

Why is this?? What I am doing wrong?

Edit2: By the way, I forgot mentioning that Task belongs_to User, and the User model has been generated by devise. Which probably is whats causing this. Can’t I access /tasks/index without /user/id/tasks/?

Edit: more weird stuff, I tried using resources :tasks in my routes file, instead of the ‘get’ routes for that controller, and now when I click on <%= link_to 'Tasks', :controller => 'tasks', :action => 'index' %> it takes me to the show action. So something is really wrong with my routes, apparently.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:15:09+00:00Added an answer on May 27, 2026 at 9:15 am

    The problem is with ‘devise’ namespace. When you use link creation this way:

    <%= link_to 'Tasks', :controller => 'tasks', :action => 'index' %>
    

    then the route is generated from the current namespace, which is ‘devise’ when you click any devise link.

    To avoid this behavior, you can either use the route this way:

    <%= link_to 'Tasks', :controller => '/tasks', :action => 'index' %>
    

    or use helpers, which work correctly in this situation (tasks_index_path in case of ‘get “tasks/index”‘ in routes.rb, or tasks_path in case of resources :tasks)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Devise in Rails 3, and have a User model in rails
I'm localizing an iPhone app for the first time. I've put all my strings
This is the first time I am using push notification in my App. I
I'm using UIGestureRecognizer for the first time and I want my app to run
I am developing my first app for Android, for now I was using ADT
I’m having a little problem with an app I’m working on. The app shows
I'm using Omniauth with Devise to authenticate users via Facebook for a web app
I'm working on my first PhoneGap app with JQuery Mobile and I've having a
I Have a strange problem with iphone in app purchase! i created a product
I'm trying to make an app for android using facebook's SSO, so first i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.