Skip to content

Commit

Permalink
Minor Fixes. (#47)
Browse files Browse the repository at this point in the history
* Avoids ActiveRecord deprecation warning.

- removes database user, to run out of the box

* makes rubocop happy
  • Loading branch information
LeFnord authored Oct 31, 2023
1 parent ac268b2 commit 1e4984a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 3 additions & 3 deletions lib/starter/builder/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def initializer # rubocop:disable Metrics/MethodLength
logger = if %w[development test].include? env
log_dir = File.join(Dir.getwd, 'log')
log_file = File.join(log_dir, 'db.log')
FileUtils.mkdir(log_dir) unless Dir.exist?(log_dir)
FileUtils.mkdir_p(log_dir)
Logger.new(File.open(log_file, 'a'))
else
Logger.new($stdout)
Expand All @@ -46,12 +46,12 @@ def initialize(app)
def call(env)
response = @app.call(env)
response[2] = ::Rack::BodyProxy.new(response[2]) do
ActiveRecord::Base.clear_active_connections!
ActiveRecord::Base.connection_handler.clear_active_connections!
end
return response
rescue StandardError
ActiveRecord::Base.clear_active_connections!
ActiveRecord::Base.connection_handler.clear_active_connections!
raise
end
end
Expand Down
3 changes: 0 additions & 3 deletions lib/starter/orms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,18 @@ def config
adapter: #{adapter}
encoding: unicode
timeout: 5000
user: postgres
database: #{@name}_development
test:
adapter: #{adapter}
encoding: unicode
timeout: 5000
user: postgres
database: #{@name}_test
production:
adapter: #{adapter}
encoding: unicode
timeout: 5000
user: postgres
database: #{@name}_production
FILE
end
Expand Down

0 comments on commit 1e4984a

Please sign in to comment.