Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Workaround for 3.0 not having param_key and fix valid? on attr/sort

  • Loading branch information...
commit cef7b8ecea96a89a8ce3c80ee6de70788074b1d9 1 parent 742c638
Ernie Miller ernie authored
1  lib/ransack/helpers/form_helper.rb
View
@@ -16,6 +16,7 @@ def search_form_for(record, options = {}, &proc)
:id => options[:as] ? "#{options[:as]}_search" : "#{search.klass.to_s.underscore}_search",
:method => :get
}
+ options[:as] ||= 'q'
options[:html].reverse_merge!(html_options)
options[:builder] ||= FormBuilder
2  lib/ransack/nodes/attribute.rb
View
@@ -19,7 +19,7 @@ def name=(name)
end
def valid?
- attr
+ bound? && attr
end
def type
4 lib/ransack/nodes/bindable.rb
View
@@ -16,6 +16,10 @@ def klass
@klass ||= context.klassify(parent)
end
+ def bound?
+ attr_name.present? && parent.present?
+ end
+
def reset_binding!
@parent = @attr_name = @attr = @klass = nil
end
2  lib/ransack/nodes/sort.rb
View
@@ -24,7 +24,7 @@ def build(params)
end
def valid?
- attr
+ bound? && attr
end
def name=(name)
Please sign in to comment.
Something went wrong with that request. Please try again.