lib/gizzard/mysql.rb in gizzard-0.1.0 vs lib/gizzard/mysql.rb in gizzard-0.2.0
- old
+ new
@@ -6,11 +6,11 @@
scope :filtered_by, -> (column, value) do
v = value.respond_to?(:strip) ? value.strip : value
v.present? ? where(column => value) : all
end
- scope :forward_matching_by, -> (column, value) { where("`#{table_name}`.`#{column}` LIKE ?", "%#{sanitize_sql_like(value)}") }
- scope :backward_matching_by, -> (column, value) { where("`#{table_name}`.`#{column}` LIKE ?", "#{sanitize_sql_like(value)}%") }
+ scope :forward_matching_by, -> (column, value) { where("`#{table_name}`.`#{column}` LIKE ?", "#{sanitize_sql_like(value)}%") }
+ scope :backward_matching_by, -> (column, value) { where("`#{table_name}`.`#{column}` LIKE ?", "%#{sanitize_sql_like(value)}") }
scope :partial_matching_by, -> (column, value) { where("`#{table_name}`.`#{column}` LIKE ?", "%#{sanitize_sql_like(value)}%") }
end
class_methods do
def order_by_field(column, values)