# Line item confusion

**URL:** <https://www.ruby-forum.com/t/line-item-confusion/147144>\
**Category:** Rails\
**Created:** [August 28, 2008, 8:31pm UTC](https://www.ruby-forum.com/t/line-item-confusion/147144 "2008-08-28T20:31:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tyliong](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e9a140/32.png) [@tyliong](https://www.ruby-forum.com/u/tyliong)\
**Post date:** [August 28, 2008, 8:31pm UTC](https://www.ruby-forum.com/t/line-item-confusion/147144/1 "2008-08-28T20:31:36Z")

</div>

I am trying to create a search engine that will save an item of a user  
into a line item.

When the user searches inside his home page(localhost/user/3)

each item displayed in the search has a button link to add to the line  
item

how do i tell the item to add the product\_id to the user\_id in the  
line item??

{{code}}

line\_item

belongs\_to :user\_id(foreign key)  
belongs\_to :product\_id(foreign key)
