searchable: fixup bugs in e7b454686.
This commit is contained in:
@@ -35,7 +35,7 @@ module Searchable
|
|||||||
elsif has_attribute?(field)
|
elsif has_attribute?(field)
|
||||||
node = arel_table[field]
|
node = arel_table[field]
|
||||||
else
|
else
|
||||||
node = Arel.sql(field)
|
node = Arel.sql(field.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
arel = node.send(operator, *args, **options)
|
arel = node.send(operator, *args, **options)
|
||||||
|
|||||||
@@ -658,12 +658,12 @@ class Post < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
when /^-child:(.+)$/i
|
when /^-child:(.+)$/i
|
||||||
children.numeric_attribute_matches(:id, $1).each do |post|
|
children.search(id: $1).each do |post|
|
||||||
post.update!(parent_id: nil)
|
post.update!(parent_id: nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
when /^child:(.+)$/i
|
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)
|
post.update!(parent_id: id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user