Skip to content

Commit

Permalink
Merge pull request #9 from friendlycart/engine-extension
Browse files Browse the repository at this point in the history
Change autoload paths directly
  • Loading branch information
mamhoff authored Jan 14, 2025
2 parents 49b0dcb + f4b31d4 commit b009a89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions lib/flickwerk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class Error < StandardError; end
mattr_accessor :aliases, default: {}

def self.included(engine)
engine.root.glob("app/patches/*").each do |path|
Flickwerk.patch_paths << path
end
engine_patch_paths = engine.root.glob("app/patches/*")
engine.config.autoload_paths += engine_patch_paths
Flickwerk.patch_paths += engine_patch_paths
end

def self.patch(class_name, with:)
Expand Down
6 changes: 0 additions & 6 deletions lib/flickwerk/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@
require "rails/railtie"

class Flickwerk::Railtie < Rails::Railtie
initializer "flickwerk.add_paths", before: :set_autoload_paths do |app|
Flickwerk.patch_paths.each do |path|
app.config.autoload_paths << path
end
end

initializer "flickwerk.find_patches" do |app|
app.reloader.to_prepare do
Flickwerk.patch_paths.each do |path|
Expand Down

0 comments on commit b009a89

Please sign in to comment.