我根据第240号铁路计划的一部分指示进行了简单搜查。
in controller
@reports = Report.search(params[:search]).order( created_at DESC ).paginate(:page => params[:page], :per_page => 5)
模型
def self.search(search)
if search
where( apparatus LIKE ? , "%#{search}")
else
scoped
end
end
目 录
<%= form_tag reports_path, :method => :get do %>
<p>
<%= text_field_tag :search, params[:search] %>
<%= submit_tag "Search", :name => nil %>
</p>
<% end %>
it all works... but...
I have a few records for example, one with "another time test" and another with "last test of time"
if i search "test" the first comes up but the second doesn t, and if i search "time" the second comes up but not the first. It is only seeing the last word of the record.
什么?