Skip to content

Commit

Permalink
Merge pull request #76 from yamat47/bullet
Browse files Browse the repository at this point in the history
Bullet
  • Loading branch information
yamat47 authored Aug 15, 2024
2 parents ad46518 + ac41b3f commit 60a8204
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/.rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Metrics/AbcSize:
Metrics/BlockLength:
Exclude:
- 'spec/**/*_spec.rb'
- 'config/environments/development.rb'

Metrics/MethodLength:
Exclude:
Expand Down
1 change: 1 addition & 0 deletions app/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ gem 'turbo-rails'
gem 'tzinfo-data'

group :development, :test do
gem 'bullet'
gem 'debug', platforms: %i[mri windows]
gem 'factory_bot_rails'
gem 'faker'
Expand Down
5 changes: 5 additions & 0 deletions app/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ GEM
bootsnap (1.18.4)
msgpack (~> 1.2)
builder (3.3.0)
bullet (7.2.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
crass (1.0.6)
Expand Down Expand Up @@ -353,6 +356,7 @@ GEM
tzinfo-data (1.2024.1)
tzinfo (>= 1.0.0)
unicode-display_width (2.5.0)
uniform_notifier (1.16.0)
uri (0.13.0)
useragent (0.16.10)
version_gem (1.1.4)
Expand All @@ -370,6 +374,7 @@ PLATFORMS
DEPENDENCIES
aws-sdk-s3
bootsnap
bullet
debug
factory_bot_rails
faker
Expand Down
1 change: 1 addition & 0 deletions app/app/controllers/admin/game_schedules_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class GameSchedulesController < ApplicationController
def index
@game_schedules = GameSchedule.start_at_ordered
.search_by_keyword(index_params[:search])
.preload(:season, :tournament, :home_team, :visitor_team, :game_field)
.page(index_params[:page])
.per(INDEX_PER_PAGE)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
module Admin
class MediaPageSettingsController < ApplicationController
def show
@media_hero_images = MediaHeroImage.sort_order_ordered
@media_hero_images = MediaHeroImage.preload(image_attachment: :blob).sort_order_ordered
end
end
end
2 changes: 1 addition & 1 deletion app/app/controllers/media/game_schedules_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def index
game_schedules = GameSchedule.start_at_ordered
.game_field_ordered
.where(season: @season)
.preload(:home_team, :visitor_team, :game_field, :tournament)
.preload(:home_team, :visitor_team, :game_field, :tournament, :game_result)

# group by date.
@game_schedule_groups = game_schedules.group_by { |game_schedule| game_schedule.start_at.to_date }
Expand Down
2 changes: 2 additions & 0 deletions app/app/controllers/media/homes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ class HomesController < ApplicationController

def show
@media_hero_images = MediaHeroImage.sort_order_ordered
.preload(image_attachment: :blob)

@notices = Notice.only_published
.published_at_ordered
.limit(NOTICES_LIMIT)

@game_schedules = GameSchedule.next_scheduled_games
.preload(:game_field, :tournament, :home_team, :visitor_team, :game_result)
end
end
end
4 changes: 2 additions & 2 deletions app/app/views/admin/game_schedules/_form.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
= GameSchedule.human_attribute_name(:home_team)
.admin-field__value
= form.select_with_image(:home_team_id,
Team.all,
Team.preload({ logo_attachment: :blob }),
value_method: :id,
text_method: :name,
image_method: :logo_url,
Expand All @@ -43,7 +43,7 @@
= GameSchedule.human_attribute_name(:visitor_team)
.admin-field__value
= form.select_with_image(:visitor_team_id,
Team.all,
Team.preload({ logo_attachment: :blob }),
value_method: :id,
text_method: :name,
image_method: :logo_url,
Expand Down
11 changes: 11 additions & 0 deletions app/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,15 @@

# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
# config.generators.apply_rubocop_autocorrect_after_generate!

config.after_initialize do
Bullet.enable = true
Bullet.alert = true
Bullet.rails_logger = true
Bullet.add_footer = true
Bullet.skip_html_injection = false

Bullet.add_safelist type: :unused_eager_loading, class_name: 'ActiveStorage::Attachment',
association: :blob
end
end

0 comments on commit 60a8204

Please sign in to comment.