Skip to content

Explicitly declaring attributes #833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ def talks_in_running_order(child_talks: true)
scope :upcoming, -> { where(date: Date.today..).order(date: :asc) }

# enums
attribute :kind, :string
enum :kind, ["event", "conference", "meetup"].index_by(&:itself), default: "event"

attribute :date_precision, :string
enum :date_precision, ["day", "month", "year"].index_by(&:itself), default: "day"

def assign_canonical_event!(canonical_event:)
Expand Down
2 changes: 2 additions & 0 deletions app/models/talk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ class Talk < ApplicationRecord

# enums
enum :video_provider, %w[youtube mp4 vimeo scheduled not_published not_recorded parent children].index_by(&:itself)

attribute :kind, :string
enum :kind,
%w[keynote talk lightning_talk panel workshop gameshow podcast q_and_a discussion fireside_chat
interview award].index_by(&:itself)
Expand Down
20 changes: 15 additions & 5 deletions data/belfastruby/belfastruby-meetup/videos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
Be sure to watch this space for any updates!

https://www.meetup.com/belfastruby/events/226588609
talks: [] # TODO: Add talks
talks:
[]
# TODO: Add talks

- title: "Belfast Ruby Meetup March 2016"
raw_title: "Belfast Ruby: March Meetup"
Expand All @@ -47,7 +49,9 @@
Be sure to watch this space for any updates!

https://www.meetup.com/belfastruby/events/229455224
talks: [] # TODO: Add talks
talks:
[]
# TODO: Add talks

- title: "Belfast Ruby Meetup March 2017"
raw_title: "Belfast Ruby: Reboot & March Meetup"
Expand Down Expand Up @@ -88,7 +92,9 @@
Stephen

https://www.meetup.com/belfastruby/events/238111264
talks: [] # TODO: Add talks
talks:
[]
# TODO: Add talks

- title: "Belfast Ruby Meetup November 2023"
raw_title: "Belfast Ruby: The Reboot Meetup"
Expand Down Expand Up @@ -119,7 +125,9 @@
The BelfastRuby Team

https://www.meetup.com/belfastruby/events/296946915
talks: [] # TODO: Add talks
talks:
[]
# TODO: Add talks

- title: "Belfast Ruby Meetup March 2024 (Cancelled)"
raw_title: "Belfast Ruby: The Campfire Code Review Meetup"
Expand Down Expand Up @@ -175,7 +183,9 @@
Cast your vote in the #belfastruby room on the Northern Ireland Tech Slack to help decide the lineup. Stay tuned for updates on the final plan. Hosted at Magnite and proudly sponsored by SkillfulGorilla. Don’t miss this chance to connect with the Ruby community in Belfast!

https://www.meetup.com/belfastruby/events/306590652
talks: [] # TODO: Add talks
talks:
[]
# TODO: Add talks

- title: "Belfast Ruby Meetup April 2025"
raw_title: "Belfast Ruby: James Stocks, Pablo Brasero, Matt Hutchinson, Nick Schwaderer"
Expand Down
51 changes: 40 additions & 11 deletions db/migrate/20250128070756_add_unique_index_on_github_in_speaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,46 @@ def up
speaker.assign_canonical_speaker!(canonical_speaker: speaker.canonical)
end

# fix one by one
Speaker.find_by(name: "Andrew").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(name: "Andrew Nesbitt"))
Speaker.find_by(name: "HASUMI Hitoshi").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(name: "Hitoshi Hasumi"))
Speaker.find_by(name: "hogelog").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(name: "Sunao Hogelog Komuro"))
Speaker.find_by(name: "Jônatas Paganini").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(name: "Jônatas Davi Paganini"))
Speaker.find_by(name: "Sutou Kouhei").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(name: "Kouhei Sutou"))
Speaker.find_by(slug: "maciek-rzasa").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(slug: "maciej-rzasa"))
Speaker.find_by(slug: "mario-alberto-chavez").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(slug: "mario-chavez"))
Speaker.find_by(slug: "enrique-morellon").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(slug: "enrique-mogollan"))
Speaker.find_by(slug: "masafumi-okura").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(slug: "okura-masafumi"))
Speaker.find_by(slug: "oliver-lacan").assign_canonical_speaker!(canonical_speaker: Speaker.find_by(slug: "olivier-lacan"))
# fix one by one - with nil checks for safety
andrew_speaker = Speaker.find_by(name: "Andrew")
andrew_nesbitt_speaker = Speaker.find_by(name: "Andrew Nesbitt")
andrew_speaker&.assign_canonical_speaker!(canonical_speaker: andrew_nesbitt_speaker) if andrew_nesbitt_speaker

hasumi_speaker = Speaker.find_by(name: "HASUMI Hitoshi")
hitoshi_speaker = Speaker.find_by(name: "Hitoshi Hasumi")
hasumi_speaker&.assign_canonical_speaker!(canonical_speaker: hitoshi_speaker) if hitoshi_speaker

hogelog_speaker = Speaker.find_by(name: "hogelog")
sunao_speaker = Speaker.find_by(name: "Sunao Hogelog Komuro")
hogelog_speaker&.assign_canonical_speaker!(canonical_speaker: sunao_speaker) if sunao_speaker

jonatas_speaker = Speaker.find_by(name: "Jônatas Paganini")
jonatas_davi_speaker = Speaker.find_by(name: "Jônatas Davi Paganini")
jonatas_speaker&.assign_canonical_speaker!(canonical_speaker: jonatas_davi_speaker) if jonatas_davi_speaker

sutou_speaker = Speaker.find_by(name: "Sutou Kouhei")
kouhei_speaker = Speaker.find_by(name: "Kouhei Sutou")
sutou_speaker&.assign_canonical_speaker!(canonical_speaker: kouhei_speaker) if kouhei_speaker

maciek_speaker = Speaker.find_by(slug: "maciek-rzasa")
maciej_speaker = Speaker.find_by(slug: "maciej-rzasa")
maciek_speaker&.assign_canonical_speaker!(canonical_speaker: maciej_speaker) if maciej_speaker

mario_alberto_speaker = Speaker.find_by(slug: "mario-alberto-chavez")
mario_speaker = Speaker.find_by(slug: "mario-chavez")
mario_alberto_speaker&.assign_canonical_speaker!(canonical_speaker: mario_speaker) if mario_speaker

enrique_morellon_speaker = Speaker.find_by(slug: "enrique-morellon")
enrique_mogollan_speaker = Speaker.find_by(slug: "enrique-mogollan")
enrique_morellon_speaker&.assign_canonical_speaker!(canonical_speaker: enrique_mogollan_speaker) if enrique_mogollan_speaker

masafumi_speaker = Speaker.find_by(slug: "masafumi-okura")
okura_speaker = Speaker.find_by(slug: "okura-masafumi")
masafumi_speaker&.assign_canonical_speaker!(canonical_speaker: okura_speaker) if okura_speaker

oliver_speaker = Speaker.find_by(slug: "oliver-lacan")
olivier_speaker = Speaker.find_by(slug: "olivier-lacan")
oliver_speaker&.assign_canonical_speaker!(canonical_speaker: olivier_speaker) if olivier_speaker
add_index :speakers, :github, unique: true, where: "github IS NOT NULL AND github != ''"
end

Expand Down
2 changes: 1 addition & 1 deletion db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.