Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
@@ -16,6 +16,7 @@ def search_form_for(record, options = {}, &proc)
16 16 :id => options[:as] ? "#{options[:as]}_search" : "#{search.klass.to_s.underscore}_search",
17 17 :method => :get
18 18 }
  19 + options[:as] ||= 'q'
19 20 options[:html].reverse_merge!(html_options)
20 21 options[:builder] ||= FormBuilder
21 22
2  lib/ransack/nodes/attribute.rb
@@ -19,7 +19,7 @@ def name=(name)
19 19 end
20 20
21 21 def valid?
22   - attr
  22 + bound? && attr
23 23 end
24 24
25 25 def type
4 lib/ransack/nodes/bindable.rb
@@ -16,6 +16,10 @@ def klass
16 16 @klass ||= context.klassify(parent)
17 17 end
18 18
  19 + def bound?
  20 + attr_name.present? && parent.present?
  21 + end
  22 +
19 23 def reset_binding!
20 24 @parent = @attr_name = @attr = @klass = nil
21 25 end
2  lib/ransack/nodes/sort.rb
@@ -24,7 +24,7 @@ def build(params)
24 24 end
25 25
26 26 def valid?
27   - attr
  27 + bound? && attr
28 28 end
29 29
30 30 def name=(name)

0 comments on commit cef7b8e

Please sign in to comment.
Something went wrong with that request. Please try again.