Skip to content

Commit

Permalink
Merge 95600ca into f86d54c
Browse files Browse the repository at this point in the history
  • Loading branch information
mrhardikjoshi committed Jan 8, 2024
2 parents f86d54c + 95600ca commit e055bff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
2 changes: 2 additions & 0 deletions lib/active_graph.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
loader.ignore(File.expand_path('rails', __dir__))
loader.ignore(File.expand_path('active_graph/railtie.rb', __dir__))
loader.inflector.inflect("ansi" => "ANSI")
module ActiveGraph
end
loader.setup
# loader.eager_load

Expand Down
12 changes: 7 additions & 5 deletions lib/active_graph/railtie.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# Need the action_dispatch railtie to have action_dispatch.rescue_responses initialized correctly
require 'action_dispatch/railtie'
require 'rails/generators'
require 'rails/generators/active_model'
require 'rails/generators/named_base'
require 'rails/railtie'
require File.expand_path('../rails/generators/migration_helper.rb', __dir__)
Rails::Generators::GeneratedAttribute.include ActiveGraph::Generators::GeneratedAttribute
require 'active_graph'

module ActiveGraph
Expand Down Expand Up @@ -44,6 +39,13 @@ def empty_config
ActiveGraph::Config[:verbose_query_logs] = false
end

# By default, Rails loads generators from load path.
# However, if we want to place generators at a different location we have to use "generators" hook
# https://api.rubyonrails.org/classes/Rails/Railtie.html
generators do
require File.expand_path('../rails/generators/migration_helper.rb', __dir__)
end

# Starting Neo after :load_config_initializers allows apps to
# register migrations in config/initializers
initializer 'neo4j.start', after: :load_config_initializers do |app|
Expand Down
3 changes: 3 additions & 0 deletions lib/rails/generators/migration_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,3 +101,6 @@ def type_class
end
end
end

require 'rails/generators/named_base'
Rails::Generators::GeneratedAttribute.include ActiveGraph::Generators::GeneratedAttribute

0 comments on commit e055bff

Please sign in to comment.