Him I'm building a kind of auction application except instead of buying
and selling items, users can swap them with each other. I am struggling
with the syntax for the queries.
I have tables for items, auctions, bids and users set up as follows.
Bid has many items as I would like the user to be able to offer more
than one item in their bid, for example one user trades 3 items with
another user for 1 more expensive item.
I'm trying to find all auctions that the current user has placed a bid
on (I would like to display the item title of the auction).
At the moment I can only work out how to get the auction ID like so...
@bids = Bid.find(:all, :conditions => ["user_id = ?",
Then in the view...
<% for bid in @bids %>
<td><%= bid.auction_id %></td>
Finally, how can I make the search unique? IE if the user has placed
multiple bids on one auctions, how can I make that auction appear only
once in the results?
I think I could work it out ok in SQL, but I have found it difficult to
find many resouces on ruby.
Any advice would be appreciated. Thanks.