控制器
class FeedEntriesController < ApplicationController
def index
@search = FeedEntry.search(params[:search])
@feed_entries = @search.page(params[:page])
@app_keys = AppKey.all
end
end
我的feed_entries / index.html.erb
<%= link_to "Stared", {:controller => "feed_entries", :action => "index", :search => ['is_star = ?', true] }%>
feed_entries表包含is_star:boolean
属性。所以,我只想将参数is_star == true传递给参数[:search]。
但上面的代码不起作用。请有人帮助我。
答案 0 :(得分:1)
尝试
<%= link_to "Stared", {:controller => "feed_entries", :action => "index", :is_star => true } %?
然后您应该能够使用params[:is_star]