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

  • Home
  • SEARCH
  • 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 8798683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:08:58+00:00 2026-06-14T00:08:58+00:00

I have a Users resource and I want to display the edit link in

  • 0

I have a Users resource and I want to display the “edit” link in the show.html.erb files only when that user is logged in. See screenshots.

Here is a list of users. Notice in the top right that Roger Sterling is logged in.

Here is a list of users. Notice in the top right that Roger Sterling is logged in.

But if I click on Don Draper, the show.html.erb file displays the "Edit" button. I only want that to appear for Roger Sterling, in this case.

But if I click on Don Draper, the show.html.erb file displays the “Edit” button. I only want that to appear for Roger Sterling, in this case.

I’m using Devise for authentication. Any ideas on how to accomplish this? Let me know if you need to see any available code.

  • 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-06-14T00:09:00+00:00Added an answer on June 14, 2026 at 12:09 am

    Ha. Ok I got it.

    Here is the loop in the show.html.erb file:

    <% if (@user.name == current_user.name) %>
        <%= link_to 'Edit', edit_user_registration_path(@user) %> 
    <% end %>  
    

    And the helper method:

    def correct_user
        user == current_user
    end
    

    Thanks for the push in the right direction!

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

Sidebar

Related Questions

Rails beginner here.. I have a users resource where I implemented a callback that's
I have a user control and it uses resource dictionaries. In that user control,
I have an EJB that uses additional resource files (textual template files placed in
I have an rc file that uses relative paths to locate the resource files
My Question If you want to display Pinyin for Chinese-speaking users, in what resource
I have a resource database where resources can belong to different locations. Users and
I have a resource Photos, which belongs to Adverts. In ActiveAdmin, users should be
I have the following user resource: class UserResource(ModelResource): class Meta: queryset = User.objects.all() resource_name
I have the following structure: class User include Mongoid::Document end class Resource include Mongoid::Document
I have user HeaderedItemsControl to display different UserControl in my application. Now I declared

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.