Skip to content

Commit

Permalink
Fallback to @search object if params_scope does not represent the obj…
Browse files Browse the repository at this point in the history
…ect name
  • Loading branch information
binarylogic committed Dec 10, 2008
1 parent 5670574 commit 1a02fb0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rdoc
Expand Up @@ -2,6 +2,7 @@

* Group multi faceted conditions since we allow for the mix of "and" and "or"
* Blank arrays are not meaningful values for conditions
* Check for instance variable name based off of the param scope, if not present, then check for the default @search object

== 1.6.0 released 2008-12-8

Expand Down
2 changes: 1 addition & 1 deletion lib/searchlogic/helpers/utilities.rb
Expand Up @@ -121,7 +121,7 @@ def searchlogic_state(options = {})
# Adds default options for all helper methods.
def add_searchlogic_defaults!(options)
options[:params_scope] = :search unless options.has_key?(:params_scope)
options[:search_obj] ||= instance_variable_get("@#{options[:params_scope]}")
options[:search_obj] ||= instance_variable_get("@#{options[:params_scope]}") || instance_variable_get("@search")
raise(ArgumentError, "@search object could not be inferred, please specify: :search_obj => @search or :params_scope => :search_obj_name") unless options[:search_obj].is_a?(Searchlogic::Search::Base)
options
end
Expand Down

0 comments on commit 1a02fb0

Please sign in to comment.