diff --git a/Procfile.dev b/Procfile.dev
index 21de3cc..ca63a50 100644
--- a/Procfile.dev
+++ b/Procfile.dev
@@ -1,3 +1,2 @@
-
-web: RUBY_DEBUG_OPEN=true bundle exec -- rails server --port "${RAILS_PORT:-7500}"
+web: bundle exec -- rails server --port "${RAILS_PORT:-7500}"
css: bundle exec -- rails tailwindcss:watch
diff --git a/app/views/scores/index.html.erb b/app/views/scores/index.html.erb
index 15c2fca..563c9cc 100644
--- a/app/views/scores/index.html.erb
+++ b/app/views/scores/index.html.erb
@@ -4,8 +4,8 @@
ACTION_VIEW = <%=Live::Constants::ACTION_VIEW%>
ACTIVE_RECORD = <%=Live::Constants::ACTIVE_RECORD%>
-<%= Score.first %>
-<%= Score.first %>
+<%= Score.last %>
+<%= Score.last %>
<%= link_to "New score", new_score_path, class: "border rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 2868206..92a8945 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/integer/time'
+require 'debug/open_nonstop' if Rails.application.server? # opt-in for debugger
Rails.application.configure do # rubocop:disable Metrics/BlockLength
# Settings specified here will take precedence over those in config/application.rb.
diff --git a/config/initializers/pagy.rb b/config/initializers/pagy.rb
new file mode 100644
index 0000000..4ca46b9
--- /dev/null
+++ b/config/initializers/pagy.rb
@@ -0,0 +1,6 @@
+require 'pagy/extras/overflow'
+require 'pagy/extras/array'
+
+Pagy::DEFAULT[:overflow] = :last_page
+Pagy::DEFAULT[:limit] = 10 # items per page
+Pagy::I18n.load({ locale: 'fr' }, { locale: 'en' })
diff --git a/lib/semantic/subscribers/active_record.rb b/lib/semantic/subscribers/active_record.rb
index 433083c..273aa19 100644
--- a/lib/semantic/subscribers/active_record.rb
+++ b/lib/semantic/subscribers/active_record.rb
@@ -4,20 +4,24 @@ module Semantic
class ActiveRecord < LogSubscriber
include AnsiColors
+ IGNORE_PAYLOAD_NAMES = %w[SCHEMA EXPLAIN].freeze
+
def sql(event)
name = event.payload[:name]
- return if name == 'SCHEMA'
+ return if IGNORE_PAYLOAD_NAMES.include?(name)
- sql = event.payload[:sql]
- cached = event.payload[:cached]
- row_count = event.payload[:row_count]
- logger.debug("#{name}: #{sql} cached=#{cached} count=#{row_count}")
+ if name.end_with?('Load')
+ name = event.payload[:cached] ? "#{name} (cached)" : "#{name} (#{event.payload[:row_count]})"
+ end
+ name = colorize(name, TEXT_CYAN)
+ sql = colorize(event.payload[:sql], TEXT_BLUE)
+ logger.debug("#{name} #{sql}")
end
def instantiation(event)
- class_name = event.payload[:class_name]
- record_count = event.payload[:record_count]
- logger.debug("instantiate #{class_name} #{record_count} times")
+ # class_name = event.payload[:class_name]
+ # record_count = event.payload[:record_count]
+ # logger.debug("instantiate #{class_name} #{record_count} times")
end
def strict_loading_violation(event) = any_hook event