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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:07:09+00:00 2026-05-23T07:07:09+00:00

Im super new to programming and trying to get to grips with rails, I’m

  • 0

Im super new to programming and trying to get to grips with rails, I’m having trouble getting my head around how to route links to certain pages in my app.

I have a table of users reviews and venues, where a user has many reviews and a venue has many reviews.

The reviews are displayed as partials on the appropriate venues show page and each partial contains info on the user who wrote it.

review partial

<div class="review">
  <% link_to @user do %>
    <div class="reviewer_details">
      <div class="reviewer_details_photo">
        <%= image_tag review.user.avatar.url(:thumb) %>
      </div>
      <%= review.user.username %>
    </div>
  <% end %>

  <div class="review_content">
    <div class="review_partial_star_rating" style="width: <%= review.rating*20 %>px;"></div>

    <h2 class="review_partial_title"><%= review.title %></h2>
  </div>

  <% if can? :update, review %>
    <div class="review_partial_option">
      <%= link_to 'edit', edit_review_path(review) %>
    </div>
  <% end %>

  <div class="clearall"></div>
</div>

The line <% link_to @user do %> is redirecting to the current page (the venues show page), I want it to redirect to the users show page.

What am I missing here? and where can I read up on this to get it right? I’m confused as when to use @user, :user, user or User.

Thanks for any help its much appreciated!

  • 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-23T07:07:10+00:00Added an answer on May 23, 2026 at 7:07 am

    This is a great start – looks like you just need to learn a bit more Ruby and you’ll get what’s going on here. You’ve got two questions, one about view helpers and the other about variables, symbols and constants. I’ll take a stab at each.

    In your case, the link_to tag should be used something like this:

    <%= link_to user_path(@user) %>
    

    Assuming that you’re using default Rails routing, you’re using the link_to helper to point to the users_controller#show method for @user.

    The second part of your question is as follows:

    User is a constant for all of the User objects you want to create. Think of it as a blueprint for all users. User.new creates an empty, unsaved user object for you to fill with the information you need.

    user is a variable. It will only be available within the context of whatever you’re working on. If you were to say user = User.new in your controller, that user object would not be available in your view.

    @user is an instance variable. It works largely the same as standard variable, but if you were to define @user = User.new in your controller, you could use that object in the view.

    :user is a user symbol. It’s a little bit harder to define what Rails will use symbols for, but you don’t need it in this situation.

    I’d recommend that you check out Why’s Poignant Guide to Ruby, or read some other intro books to learn a bit more about the structure of the language – it’ll really help to bring clarity to why you’d want each of these.

    Additionally, I use the http://www.railsapi.com for fast searching of the Ruby and Rails API.

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

Sidebar

Related Questions

Im super new to programming and I'm trying to get a shopping cart working
Super weird problem here. I'm having trouble getting jQuery to bind any selectors except
I'm super new to programming and rails. I have a table of venues and
I'm fairly new to programming for android and I'm having trouble updating a TextView
I'm still very new to Object Oriented programming and am having problems with the
Hi I'm new to android programming, I'm trying to initiate the on click method
I am new to socket programming and trying to write a simple cmd line
Hi I'm new to Android Programming and I'm trying to make a simple program
I am completly new to android programming and I try to get clicking on
I'm new to Objective-C programming so sorry for the lame question. I'm trying to

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.