File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ class Adapter
1212 def initialize ( formobj )
1313 @formobj = formobj
1414
15- @scopes_hash = @formobj . attributes
16- @argless = argless_list ( formobj )
15+ @scopes_hash = assign_scope_hashes @formobj
16+ @argless = argless_list @ formobj
1717 end
1818
1919 def call
@@ -22,9 +22,9 @@ def call
2222 end
2323
2424 private
25- # if scope is present in form but with no value (aka: an empty string)
26- # or if present in formobj but not in form (aka : a nil value )
27- # don't apply the scope && reject them from scopes_hash
25+ # Do NOT APPLY SCOPE && reject them from scopes_hash
26+ # 1. if scope is present in form but with no value (aka: an empty string )
27+ # 2. if present in formobj but not in form (aka : a nil value)
2828 def filterout_empty_string_and_nil
2929 @scopes_hash . delete_if { |scope , arg | [ "" , nil ] . include? @formobj [ scope ] }
3030 end
@@ -45,5 +45,11 @@ def argless_list(formobj)
4545 map ( &:name )
4646 end
4747
48+ # if the form object has #siphon_attributes favor that one
49+ # usefull to seperate ransack attributes from siphon ones
50+ def assign_scope_hashes ( formobj )
51+ formobj . respond_to? ( :siphon_attributes ) ?
52+ formobj . siphon_attributes : formobj . attributes
53+ end
4854 end
4955end
You can’t perform that action at this time.
0 commit comments