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 4100936
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:37:54+00:00 2026-05-20T20:37:54+00:00

So after pulling my hair out for an hour, I decided to post this

  • 0

So after pulling my hair out for an hour, I decided to post this here. I get this error:

NoMethodError in Articles#show

Showing /home/leon/sites/VIS/app/views/articles/_article.html.erb where line #3 raised:

undefined method `user_path' for #<#<Class:0x7fdd81fe1eb8>:0x7fdd81fdfdc0>
Extracted source (around line #3):

1: <div id="left-column">
2:  <p class="label-b">Author<br>
3:     <%= link_to "#{@article.user.penname}'s profile", user_path(article.user) %> 

user_path(article.user) %>

When I try to link to the article’s authoring user. My routes file:

  resources :tags

  get "admin/index"
  get "admin/show"
  get "articles/contact"
  get "articles/about"

  resources :roles

  devise_for :users, :controllers => { :registrations => "users/registrations" }

  resources :articles do
    resources :comments
  end

I do have a belongs_to :user in my article model file and a has_many :articles in my user model file. I’m using this link to link to the author’s profile within the article.

Please help! I’m using can can for my permission management and devise for my authentication, but its throwing the error within the show action of the article so I didn’t post that code. Let me know if I should. Thanks!

@Jacob

I get the same error:

NoMethodError in Articles#show

Showing /home/leon/sites/VIS/app/views/articles/_article.html.erb where line #3 raised:

undefined method `user_path’ for #<#:0x7fdd82217a98>
Extracted source (around line #3):

1:
2: Author
3: <%= link_to “#{@article.user.penname}’s profile”, article.user %>
4: Previous Versions
5: Version 7

6: <%= image_tag “add-to-favorites.png”, :class => “favorites-button” %>

The relevant part of my routes:

{:action=>"destroy", :controller=>"roles"}
      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 GET    /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"}
         user_password PUT    /users/password(.:format)                         {:action=>"update", :controller=>"devise/passwords"}
     user_registration POST   /users(.:format)                                  {:action=>"create", :controller=>"users/registrations"}
 new_user_registration GET    /users/sign_up(.:format)                          {:action=>"new", :controller=>"users/registrations"}
edit_user_registration GET    /users/edit(.:format)                             {:action=>"edit", :controller=>"users/registrations"}
     user_registration PUT    /users(.:format)                                  {:action=>"update", :controller=>"users/registrations"}
     user_registration DELETE /users(.:format)                                  {:action=>"destroy", :controller=>"users/registrations"}
     user_confirmation POST   /users/confirmation(.:format)                     {:action=>"create", :controller=>"devise/confirmations"}
 new_user_confirmation GET    /users/confirmation/new(.:format)                 {:action=>"new", :controller=>"devise/confirmations"}
     user_confirmation GET    /users/confirmation(.:format)                     {:action=>"show", :controller=>"devise/confirmations"}

Aha! It doesn’t have a route for user#show, but i’m not sure why as I have:

class UsersController < ApplicationController
...
  def show
    respond_to do |format|
      format.json { render :json => @user }
      format.xml  { render :xml => @user }
      format.html
    end

  rescue ActiveRecord::RecordNotFound
    respond_to_not_found(:json, :xml, :html)
  end

in my app/controllers folder. Do I need to move my users controller into app/controllers/devise and overload it with devise instead of application controller?

  • 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-20T20:37:54+00:00Added an answer on May 20, 2026 at 8:37 pm

    I figured it out. After playing around with the routes for a while and reading the rails documentation, I added this line to my routes file:

    devise_for :users, :controllers => { :registrations => “users/registrations” }

    resources :users, :only => [:index, :show] <== THIS LINE

    below my devise_for routes. This allows me to display the user profiles without having to worry about the edit update etc. roles that devise provides for. Thanks for the answers anyway guys, I appreciate it!

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

Sidebar

Related Questions

So after pulling my hair out for 30 minutes, I have decided to come
after pulling my hair out for two days trying to figure this issue out
I am pulling my hair out!! grrr... This seems to work: //get all the
After pulling all my hair out it has come down to this minimal html
I've been pulling my hair out trying to get some data to come across
Hi Ive been pulling my hair out over this for the last couple of
I'm currently pulling my hair out solving this bug :/ I have already tried
I'm pulling my hair out, I cannot seem to get mouse events to work
I'm pulling my hair out here for that I can't understand what is going
I am pulling my hair out with this one. I have a table inside

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.