看板 Ruby 關於我們 聯絡資訊
環境: Rails 3.0.1 狀況: 我在controller裡寫了以下指令,這是想要根據輸入的city來找user def output @result = User.where(['city = ?',params[:text1]]).select(:fname, :lname).all 然後應該要怎麼寫View底下的output.html.erb才能把@result結果裡的fname lname 分別顯示出來呢?是哪部分會講到這個? 還是說有其他更容易撈資料的方法?我這樣寫就一定只能顯示全部結果嗎?.. 謝謝。 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 67.186.29.24