Class: Ransack::Search
- Inherits:
-
Object
show all
- Defined in:
- lib/ransack_abbreviator/ransack_extensions/search.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_id, *args) ⇒ Object
6
7
8
9
10
11
12
13
|
# File 'lib/ransack_abbreviator/ransack_extensions/search.rb', line 6
def method_missing(method_id, *args)
method_name = method_id.to_s
writer = method_name.sub!(/\=$/, '')
decoded_param = self.context.decode_parameter(method_name)
decoded_str = writer ? "#{decoded_param}=" : decoded_param
ransack_method_missing(decoded_str.to_sym, *args)
end
|
Instance Method Details
#build(params) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/ransack_abbreviator/ransack_extensions/search.rb', line 15
def build(params)
new_params = {}
collapse_multiparameter_attributes!(params.with_indifferent_access).each do |key, value|
decoded_param = self.context.decode_parameter(key)
new_params[decoded_param] = value
end
ransack_search_build(new_params)
end
|
#ransack_method_missing ⇒ Object
4
|
# File 'lib/ransack_abbreviator/ransack_extensions/search.rb', line 4
alias_method :ransack_method_missing, :method_missing
|
#ransack_search_build ⇒ Object
3
|
# File 'lib/ransack_abbreviator/ransack_extensions/search.rb', line 3
alias_method :ransack_search_build, :build
|