Activerecord Find And Only Return Selected Columns Aligned With [:id]
I have a set of data that is in two different tables. I want to join them up on my /show page in my ruby on rails app. In the controller, I have it set to find the date, set a vari
Solution 1:
Your @hellodate is not what you think it is. This:
@hellodate = Ticket.select(:date)
will, more or less, give you the result of saying:
select"date"from"tickets"so you'll get all Tickets but only the date columns will be pulled out of the database. Presumably you just want the date from @ticket:
@ticket = Ticket.find(params[:id])
@winnings = Winnings.where(:date => @ticket.date)
Post a Comment for "Activerecord Find And Only Return Selected Columns Aligned With [:id]"