Skip to content

Commit

Permalink
fix: resource generator db check (#2882)
Browse files Browse the repository at this point in the history
* fix: resource generator db check

* fix: no method error
  • Loading branch information
Paul-Bob authored Jun 21, 2024
1 parent 4a85c71 commit 2b3820f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/generators/avo/resource_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ def can_connect_to_the_database?

result = true
# If all migrations were completed, try to generate some resource files
rescue NoMethodError
# Ignore #<NoMethodError: undefined method `check_all_pending!' for an instance of ActiveRecord::Migration>]
result = true
rescue ActiveRecord::ConnectionNotEstablished
puts error_message("Connection not established.\nRun 'rails db:setup' to resolve.")
rescue ActiveRecord::PendingMigrationError
puts error_message("Migrations are pending.\nRun 'rails db:migrate' to resolve.")
rescue => e
puts "Something went wrong while trying to geenrate an Avo resource: #{e}"
puts "Something went wrong while trying to generate an Avo resource: #{e}"
end

result
Expand Down

0 comments on commit 2b3820f

Please sign in to comment.