Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eager Load fails in decidim templates #105

Open
wants to merge 3 commits into
base: release/0.28-stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion decidim-admin/config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
mount manifest.admin_engine, at: "/#{manifest.name}", as: "decidim_admin_#{manifest.name}"
end

mount Decidim::Templates::AdminEngine, at: "/templates", as: "decidim_admin_templates" if Decidim.module_installed?(:templates)
mount Decidim::Templates::AdminEngine, at: "/templates", as: "decidim_admin_templates"

resources :users, except: [:edit, :update], controller: "users" do
member do
Expand Down
9 changes: 6 additions & 3 deletions decidim-core/lib/decidim/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -870,9 +870,12 @@ def self.module_installed?(mod)
# user lists e.g. "decidim-core" and "decidim-budgets" in it. In this
# situation, "decidim-comments" is also needed because it is a dependency
# for "decidim-budgets".
require "decidim/#{mod}"

true
if mod.to_sym == :templates
Bundler.definition.dependencies.find { |d| d.name == "decidim-templates" }.present? && require("decidim/#{mod}")
else
require "decidim/#{mod}"
true
end
rescue LoadError
false
end
Expand Down
2 changes: 2 additions & 0 deletions decidim-forms/lib/decidim/forms.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "decidim/templates" if Decidim.module_installed?(:templates)

require "decidim/forms/admin"
require "decidim/forms/api"
require "decidim/forms/engine"
Expand Down
2 changes: 2 additions & 0 deletions decidim-surveys/lib/decidim/surveys.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "decidim/templates" if Decidim.module_installed?(:templates)

require "decidim/surveys/admin"
require "decidim/surveys/api"
require "decidim/surveys/engine"
Expand Down
2 changes: 1 addition & 1 deletion decidim-templates/lib/decidim/templates/admin_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

module Decidim
module Templates
# This is the engine that runs on the public interface of `Templates`.
# This is the engine that runs on the admin panel interface of `Templates`.
class AdminEngine < ::Rails::Engine
isolate_namespace Decidim::Templates::Admin

Expand Down
Loading