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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:55:25+00:00 2026-05-25T16:55:25+00:00

I have a link <%= link_to ‘Add link’, new_link_path(:link => {:item1_id => @item.id}) %>

  • 0

I have a link

<%= link_to 'Add link', new_link_path(:link => {:item1_id => @item.id}) %>

passing to

def new
 @link = Link.new(params[:link])
 @items = Item.all

form is

<%= form_for(@link) do |f| %>
<%= f.hidden_field :item1_id %>
<%= f.collection_select :item2_id , Item.all , :id , :name %>

So I want to access like the image linked to the item1_id item. How do I access it?
i tried

@item1 = Item.find_by_id(params[:link])

and

@item1 = Item.find_by_id(params[:item_id])

but I don’t know what is right.

  • 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-25T16:55:25+00:00Added an answer on May 25, 2026 at 4:55 pm

    try:

    @item1 = Item.find(params[:link][:item1_id])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add column to ASPxGridView which would have link to other page:
Projects habtm Tasks On tasks/show.html.erb I have link_to Add This Task To Project, new_project_path(:task
I have simple delete link: = link_to Delete, messages_path(message.id), :method => :delete Gives me
I have the following link: link_to(Toggle, /jobs/#{job.id}/toggle_is_money_paid, :remote => true) which toggles the is_money_paid
I have this link: <%= link_to +1, video_votes_path( :video_id => video.id, :type => up
I have a link to a page which invokes the 'Sexy Alert Box' script
I have a link to some style sheet from the Yahoo Developer Network, this
My website utilizes ASP. I have a link to a PowerPoint file within my
I have a method song_link that calls link_to internally. I want the caller to
I want to use templavoila on an existing website. So i have to link

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.