Skip to content

Commit

Permalink
Merge pull request #40 from r7kamura/eager
Browse files Browse the repository at this point in the history
Allow to change Chanko::Config.eager_load after loading chanko
  • Loading branch information
r7kamura committed Jun 16, 2014
2 parents 0bd9d28 + f2701b9 commit c471a5b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/chanko/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ class Railtie < Rails::Railtie
end
end

if Chanko::Config.eager_load
initializer("chanko.prevent_units_directory_from_eager_loading", before: :set_autoload_paths) do |app|
initializer("chanko.prevent_units_directory_from_eager_loading", before: :set_autoload_paths) do |app|
if Chanko::Config.eager_load
Rails.configuration.eager_load_paths.delete(Rails.root.join(Chanko::Config.units_directory_path).to_s)
end
end

initializer("chanko.eager_load_units") do |app|
initializer("chanko.eager_load_units") do |app|
if Chanko::Config.eager_load
Chanko::Loader.eager_load_units!
end
end
Expand Down

0 comments on commit c471a5b

Please sign in to comment.