我正在尝试使用Dokku部署到Amazon Lightsail服务器。部署工作正常的配置,但是当我尝试进行部署时,出现错误:
/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/concern.rb:126:in `included': Cannot define multiple 'included' blocks for a Concern (ActiveSupport::Concern::MultipleIncludedBlocks)
from /app/app/models/models/concerns/productable.rb:5:in `<module:Productable>'
from /app/app/models/models/concerns/productable.rb:1:in `<top (required)>'
我尝试this,但没有解决我的问题。
在提到的文件中,我有以下代码:
module Productable
extend ActiveSupport::Concern
included do
extend FriendlyId
include PgSearch
before_validation :update_slug, on: :update, prepend: true
acts_as_paranoid
has_one :highlight, as: :highlightable, dependent: :destroy
scope :published, -> { joins(:teacher).where(status: PublishStatus::PUBLIC) }
scope :draft, -> { where(status: PublishStatus::DRAFT) }
scope :from_category_group, -> category_group { joins(category: :category_group).where("category_groups.slug = ?", category_group) }
scope :from_category, -> category { joins(:category).where("categories.slug = ?", category) }
scope :from_teacher, -> teacher_id { where(teacher_id: teacher_id) }
scope :highlighted, -> { joins(:highlight) }
pg_search_scope :search,
associated_against: {
category_group: :name,
category: :name,
teacher: :name
},
against: [:title, :description, :keywords],
ignoring: :accents,
using: {
tsearch: { prefix: true }
}
end
def update_slug
#force update slug only if title changed
self.slug = nil if self.title_changed?
end
end
将应用程序部署到Heroku时,我没有这个问题。
有人知道吗?
谢谢!