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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:04:13+00:00 2026-06-15T18:04:13+00:00

For each project that a user has blueprints for, I want to show the

  • 0

For each project that a user has blueprints for, I want to show the projects name and link to the project_path. Thanks.

These are my ActiveRecords

class User < ActiveRecord::Base
  attr_accessible :id, :name
  has_many :blueprints
  has_many :projects, :through => :blueprints
end

class Project < ActiveRecord::Base
  attr_accessible :id, :name
  has_many :blueprints
  has_many :users, :through => :blueprints
end

class Blueprint < ActiveRecord::Base
  attr_accessible :id, :name, :project_id, :user_id
  belongs_to :user
  belongs_to :project
end

My Users show Controller

def show
  @user = User.find(params[:id])
  @project = Project.find(params[:id])
  respond_to do |format|
    format.html # show.html.erb
    format.json { render json: @user }
  end
end

My Views/Users/Show.html.erb Table

    <table>
      <tr>
        <% @projects.each do |p| %>
          <td><%= p.name %></td>
        <% end %>
      </tr>
    </table>
  • 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-15T18:04:14+00:00Added an answer on June 15, 2026 at 6:04 pm

    For each project that a user has blueprints for, I want to show the projects name and link to the project_path.

    For these requirements, you can remove the @project assignment from your action. You need to look at the blueprints relation for @user, and get the associated project for each of those blueprints.

    <table>
      <tbody>
        <% @user.blueprints.each do |blueprint| %>
          <tr>
            <td><%= link_to blueprint.project.name, project_path(blueprint.project) %></td>
          </tr>
        <% end %>
      </tbody>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have multiple Python projects that have dependencies on each other. Hierarchically, these are
I'm trying to create a link so that if the current user has a
Background Each Project has one Account it is associated with. Each User can have
My solution has 4 projects, each project contains many namespaces. Currently my DLL size
A user can create an object, and he has followers that I want to
I have a project that has a number of apps. These apps translate into
My Rails 3.2 project has a devise-generated user and a set of models that
I have a project that involves polling a hardware switch each update and converting
I'm working on a SaaS project that will have each customer having an instance
I have a project that uses two independent Android libraries. Each of them contains

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.