diff --git a/README.md b/README.md index 33c33517..06997df4 100644 --- a/README.md +++ b/README.md @@ -164,6 +164,10 @@ Only the object's id and the column you are searching on will be returned in JSO Added option to use scopes. Pass scopes in an array. e.g `:scopes => [:scope1, :scope2]` +### :unscoped + Added the option to unscope the model + e.g. `:unscoped => true` + #### :column_name By default autocomplete uses method name as column name. Now it can be specified using column_name options `:column_name => 'name'` diff --git a/lib/rails3-jquery-autocomplete/orm/active_record.rb b/lib/rails3-jquery-autocomplete/orm/active_record.rb index 9606c0f2..9a9b13d6 100644 --- a/lib/rails3-jquery-autocomplete/orm/active_record.rb +++ b/lib/rails3-jquery-autocomplete/orm/active_record.rb @@ -18,8 +18,7 @@ def get_autocomplete_items(parameters) limit = get_autocomplete_limit(options) order = get_autocomplete_order(method, options, model) - - items = model.scoped + items = (options[:unscoped]) ? model.unscoped : model.scoped scopes.each { |scope| items = items.send(scope) } unless scopes.empty?