Merge branch 'main' into web-push
* main: (28 commits) Clean up the /scripts directory Prevent recursion when invoking AI Bump sqlite3 from 2.7.2 to 2.7.3 Port over Jeremy's fix for slow uploads .gitignore log files and portfolio's local storage Drop Current.account and just use Account.sole Use the utf8-patched mysql driver Call blob.preview for previewable attachments Make sure the image variants we use are preprocessed Add /user command Make sure it doesn't infer custom abbreviations when matching user names Script to load prod db in development Update Signup to use the queenbee_id for the tenant name Bump cache version Make sure it uses latest bundler to prevent error due to mismatch Invalidate cache Update ruby Update bundler to prevent error on lower version Update bundler to prevent error on lower version Resolve stages ...
This commit is contained in:
@@ -1,6 +1,25 @@
|
||||
module Attachments
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
# The variants we use must all declared here so that we can preprocess them.
|
||||
#
|
||||
# If they are not preprocessed, then Rails will attempt to transform the image on-the-fly when
|
||||
# they are first viewed, which may be on the read replica where writing to the database is not
|
||||
# allowed. Chaos will ensue if that happens.
|
||||
#
|
||||
# These variants are patched into ActionText::RichText in config/initializers/action_text.rb
|
||||
VARIANTS = {
|
||||
# vipsthumbnail used to create sized image variants has a intent setting to manage colors during
|
||||
# resize. By setting an invalid intent value the gif-incompatible intent filtering is skipped and
|
||||
# the gif can be rendered with all its frame intact.
|
||||
#
|
||||
# Only `n` is accepted as an override, using the full parameter name `intent` doesn’t work.
|
||||
#
|
||||
# This was cargo-culted from know-it-all and I imagine it may be fixed at some point.
|
||||
small: { loader: { n: -1 }, resize_to_limit: [ 800, 600 ] },
|
||||
large: { loader: { n: -1 }, resize_to_limit: [ 1024, 768 ] }
|
||||
}
|
||||
|
||||
def attachments
|
||||
rich_text_record&.embeds || []
|
||||
end
|
||||
|
||||
@@ -24,10 +24,13 @@ module Searchable
|
||||
|
||||
scope :search, ->(query) do
|
||||
query = Search::Query.wrap(query)
|
||||
|
||||
base = joins("join #{using} idx on #{table_name}.id = idx.rowid")
|
||||
|
||||
if query.valid?
|
||||
joins("join #{using} idx on #{table_name}.id = idx.rowid").where("#{using} match ?", query.to_s)
|
||||
base.where("#{using} match ?", query.to_s)
|
||||
else
|
||||
none
|
||||
base.none
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user