Skip to content

Commit

Permalink
Fixes a reload issue with the engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
jejacks0n committed Jul 24, 2023
1 parent f543b79 commit 52f630d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions lib/altair/rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ module Rails
class Engine < ::Rails::Engine
isolate_namespace Altair::Rails

conf = Altair::Rails.configuration
opts = { at: conf.mount_at, as: :altair }
routes { root to: Altair::Rails.configuration.altair_template }

routes { root to: conf.altair_template }

config.after_initialize { |app| app.routes.prepend { mount(Engine, opts) } } if conf.mount_at.present?
if Altair::Rails.configuration.mount_at.present?
config.after_initialize do |app|
app.routes.prepend do
mount(Engine, at: Altair::Rails.configuration.mount_at, as: :altair)
end
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/altair/rails/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def self.version
module VERSION
MAJOR = 0
MINOR = 0
TINY = 3
TINY = 4
PRE = nil

STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
Expand Down
2 changes: 1 addition & 1 deletion spec/altair/version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

RSpec.describe Altair::Rails do
it "has a version number" do
expect(described_class.version.to_s).to eq("0.0.3")
expect(described_class.version.to_s).to eq("0.0.4")
end
end

0 comments on commit 52f630d

Please sign in to comment.