-
-
Notifications
You must be signed in to change notification settings - Fork 829
Open
Milestone
Description
Suppose I have the model:
class Model < ActiveRecord::Base
scope :test_scope, -> { where(foo: "foo", bar: "bar")}
def self.ransackable_scopes(a = nil)
%i( test_scope )
end
end
the controller:
def index
@q = Model.ransack(params[:p])
@models = @q.result
if @q.groupings.blank?
@q.build_grouping
end
end
the view:
<%=search_form_for @q do |f|%>
<%=f.grouping_fields @q.groupings[0] do |g|%>
<%=g.check_box :test_scope%>
<%end%>
<%end%>
this throws:
undefined method `test_scope' for Grouping <>:Ransack::Nodes::Grouping
Is there a correct way to use groupings with scopes?
thisismydesign
Metadata
Metadata
Assignees
Labels
No labels