Skip to content

Commit fdb7bc2

Browse files
committed
Update application_controller.rb
1 parent d5fb7a6 commit fdb7bc2

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

app/controllers/application_controller.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,13 @@ def search_by_term(k, q)
190190
def search_by_field(table, field, value)
191191
case table.columns_hash[field.to_s].try(:type)
192192
when :date
193-
table.where("#{field} LIKE ?", value)
193+
if ActiveRecord::Base.connection.instance_of?(
194+
ActiveRecord::ConnectionAdapters::SQLite3Adapter
195+
)
196+
table.where("#{field} LIKE ?", value)
197+
else
198+
table.where("to_char(#{field}, 'mm yyyy') LIKE ?", value)
199+
end
194200
else
195201
table.where("LOWER(#{field}) LIKE ?", value)
196202
end

0 commit comments

Comments
 (0)