searchable: fixup bugs in e7b454686.

This commit is contained in:
evazion
2021-01-11 19:47:20 -06:00
parent a698ca2b8c
commit ef177a09cf
2 changed files with 3 additions and 3 deletions

View File

@@ -35,7 +35,7 @@ module Searchable
elsif has_attribute?(field)
node = arel_table[field]
else
node = Arel.sql(field)
node = Arel.sql(field.to_s)
end
arel = node.send(operator, *args, **options)

View File

@@ -658,12 +658,12 @@ class Post < ApplicationRecord
end
when /^-child:(.+)$/i
children.numeric_attribute_matches(:id, $1).each do |post|
children.search(id: $1).each do |post|
post.update!(parent_id: nil)
end
when /^child:(.+)$/i
Post.numeric_attribute_matches(:id, $1).where.not(id: id).limit(10).each do |post|
Post.search(id: $1).where.not(id: id).limit(10).each do |post|
post.update!(parent_id: id)
end