searchable: fixup bugs in e7b454686.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user