lib/administrate/search.rb in administrate-0.20.1 vs lib/administrate/search.rb in administrate-1.0.0.beta1
- old
+ new
@@ -57,12 +57,11 @@
def run
if query.blank?
@scoped_resource.all
else
results = search_results(@scoped_resource)
- results = filter_results(results)
- results
+ filter_results(results)
end
end
private
@@ -110,13 +109,13 @@
def search_attributes
@dashboard.search_attributes
end
def search_results(resources)
- resources.
- left_joins(tables_to_join).
- where(query_template, *query_values)
+ resources
+ .left_joins(tables_to_join)
+ .where(query_template, *query_values)
end
def valid_filters
if @dashboard.class.const_defined?(:COLLECTION_FILTERS)
@dashboard.class.const_get(:COLLECTION_FILTERS).stringify_keys
@@ -139,11 +138,11 @@
else
@scoped_resource.reflect_on_association(attr).klass.table_name
end
ActiveRecord::Base.connection.quote_table_name(unquoted_table_name)
else
- ActiveRecord::Base.connection.
- quote_table_name(@scoped_resource.table_name)
+ ActiveRecord::Base.connection
+ .quote_table_name(@scoped_resource.table_name)
end
end
def column_to_query(attr)
ActiveRecord::Base.connection.quote_column_name(attr)