2012-11-07 74 views
1

我正在使用我的Rails應用程序中的ransack gem進行高級搜索。我怎樣才能篩選attribute_select方法不顯示某些領域,如idcreated_atRails - Ransack - 自定義屬性_select

= f.attribute_fields do |a| 
    = a.attribute_select 

我目前的方法,上面羅列了任何和所有屬性。

回答

1

您還可以定義搜索的屬性與指定像這樣的非搜索者:

def self.ransackable_attributes(auth_object = nil) 
    %w(searchable_attribute_goes_here another_one_goes_here ...) + _ransackers.keys 
end