0
我有一個表symbols
其中包含列:id and symbol_name
,其中id
是表searchlogic - 搜索attr_accessor
的主鍵在我的符號模型中,我有
class Symbol < ActiveRecord::Base
def symbol_id
"EMI:#{self.id}"
end
end
在我的索引。 html.erb頁面,用戶可以通過在搜索文本框中輸入「EMI:777」來搜索ID爲777的符號。
我正在使用searchlogic進行搜索。
<% form_for @search do |f| %>
Search:
<%= f.text_field :symbol_id_or_symbol_name_like %>
<%= f.submit "Search" %>
<% end %>
當我在搜索表單中使用「symbol_id」,我得到了以下錯誤消息:
The condition 'symbol_id' is not a valid condition, we could not find any scopes that match this.
任何建議最欣賞