Skip to content

Commit

Permalink
Merge pull request #316 from sineed/fix_159_2
Browse files Browse the repository at this point in the history
related with #159: remove `respond_to?` from Ransack::Search
  • Loading branch information
jonatack committed Dec 10, 2013
2 parents 7d45262 + c33fbdd commit 9f0836d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 21 deletions.
6 changes: 0 additions & 6 deletions lib/ransack/nodes/grouping.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,9 @@ def read_attribute(name)

def strip_predicate_and_index(str)
string = str.split(/\(/).first
string = strip_before_type_cast(string)
Predicate.detect_and_strip_from_string!(string)
string
end

def strip_before_type_cast(str)
str.split("_before_type_cast").first
end

end
end
end
8 changes: 0 additions & 8 deletions lib/ransack/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,6 @@ def new_sort(opts = {})
Nodes::Sort.new(@context).build(opts)
end

def respond_to?(method_id, include_private = false)
super or begin
method_name = method_id.to_s
writer = method_name.sub!(/\=$/, '')
base.attribute_method?(method_name) ? true : false
end
end

def method_missing(method_id, *args)
method_name = method_id.to_s
writer = method_name.sub!(/\=$/, '')
Expand Down
7 changes: 0 additions & 7 deletions spec/ransack/search_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,5 @@ module Ransack
@s.groupings.first.children_name_eq.should eq 'Ernie'
end
end

describe '#respond_to' do
it 'is aware of second argument' do
Search.new(Person).respond_to?(:name_eq, true).should be_true
end
end

end
end

0 comments on commit 9f0836d

Please sign in to comment.