HI TO ALL I want to display a specific field in my VIEW but they have the same FIELD name..For example, th id in the PAYMENTS table and the id in the SUGGESTS table have the same field name... I want to be able to display the correct PAYMENTS id and correct SUGGESTS id.. My Database is big im having a hard time to trace..which id it belongs to.
In my ruby on rails action or method Controller: def print_two_table @p = Pay.find_by_sql("SELECT p.id, p.topic, s.id, s.income, s.price FROM pays as P LEFT OUTER JOIN suggests AS s ON s.b_id = p.b_id WHERE p.created_at BETWEEN '2008-03-04' AND '2008-07-06' ") end In my View action or method: <%= @p.each do |form| %> <%= form.income %><br /> <%= form.id %> <br /> <%= form.income %><br /> <% end %> It gives me the wrong id i want to display..I want to display id in payments.