Skip to content

Events stored in the database instead of YAML files - steps 1-8 - #487

Open
kcomandich wants to merge 22 commits into
rubyaustralia:mainfrom
kcomandich:feature/events_architecture
Open

kcomandich wants to merge 22 commits into
rubyaustralia:mainfrom
kcomandich:feature/events_architecture

Conversation

@kcomandich

@kcomandich kcomandich commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

Move events from a YAML file to the database, and provide a way to create/edit/delete events

There are a few remaining items to finish before it's ready to use, but I wanted to make sure I'm on the right track.

See discussion on #342. Implementation so far:

  • 1. Create an ApplicationRecord class DatabaseEvent (but use the events db table)
  • 2. Update the User class to add :meetup_admin scope
  • 3. Data migration & import from yaml file
  • 4. Clone the relevant views, except they’re populated from events table instead of yaml
  • 5. Add "Edit" button to meetup Event page to a form for updating the Event (ex. https://melbourne.ruby.org.au/events/2026-05-28-ruby-melbourne)
  • 6. Add "Add Event" button to meetup Events page (ex. https://melbourne.ruby.org.au/events) to a form for adding a new Event
  • 7. Create new events in the events table using the CRUD
  • 8. Check if it's all working - compare old views with new views (but see below for new changes)
  • 9. Replace the old views with the new views
  • 10. Delete old Event class
  • 11. Rename DatabaseEvent to Event. Remove yaml import from migration, add sample event seeds to the database. Remove OpenGraphMetadata and rename OpenGraphMetadataNew -> OpenGraphMetadata.

Note that UUIDs from the events.yml file don't appear to be used, LMK if they should be.

Still to do/fix:

  • Need ability to add/edit/delete Talks in the UI
  • Incorporate recent code changes - tabs for past/upcoming events, etc
  • In the Melbourne views, filter by region and event_type
  • Need ability to add/edit Venues in the UI

Done

✅ fix: HTML is showing up in the description when saving it
✅ Remove the date field and create a date method that just uses start_time (no need to have duplicate date and start_time fields)

Thanks to @mcgain for advising! 🙏 🎉

Screenshots:

Clone of the Melbourne event/show page, using events table, with Edit and Delete buttons:

DatabaseEvent page with Edit and Delete Events

New/Edit Event form:

DatabaseEvent Edit form

Clone of the Melbourne events page, using events table, with New button:

DatabaseEvent list with New Event button

Clone of the Melbourne home page, using events table:

DatabaseEvents home

@kcomandich
kcomandich force-pushed the feature/events_architecture branch 4 times, most recently from c8b6c90 to 0b8ef91 Compare July 8, 2026 02:52

@mcgain mcgain left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bunch of nit-picking sorry, but they are worth addressing

Comment thread app/models/database_event.rb Resolved
Comment thread app/models/database_event.rb Resolved

@mcgain mcgain left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one more

@kcomandich
kcomandich force-pushed the feature/events_architecture branch 5 times, most recently from 1e2f75e to 2360201 Compare July 21, 2026 02:42
@kcomandich
kcomandich marked this pull request as ready for review July 21, 2026 03:11
@kcomandich
kcomandich requested a review from a team as a code owner July 21, 2026 03:11
@leesheppard
leesheppard requested a review from HashNotAdam July 25, 2026 03:33
@kcomandich
kcomandich force-pushed the feature/events_architecture branch 3 times, most recently from 800ec75 to 50eb16d Compare August 4, 2026 05:05
@leesheppard
leesheppard force-pushed the feature/events_architecture branch from 50eb16d to db5f7c4 Compare August 4, 2026 06:29
@quintrino

Copy link
Copy Markdown
Member

@kcomandich, just checking, is this ready to be merged or are you still working on it before you want it merged?

@kcomandich

Copy link
Copy Markdown
Contributor Author

@kcomandich, just checking, is this ready to be merged or are you still working on it before you want it merged?

This should be ready to be merged. There is more to do for the feature but I’ll open up new PRs for further work.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Critical migration and edit-route failures, along with unresolved data scoping and rendering issues, block approval.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 2 High severity · 6 Medium severity · 1 Low severity

Open (9)
What changed in this PR

This draft moves Melbourne events from YAML to database-backed models and adds meetup-admin CRUD functionality.

Changes:

  • Adds event, talk, venue, migration/import logic, factories, and tests.
  • Adds database-event routes, controllers, presenters, views, and homepage.
  • Adds meetup-admin authorization, seeds, styling, and documentation.
File Description
spec/​models/​user_spec.rb Tests meetup-admin scope.
spec/​models/​talk_spec.rb Tests talk behavior.
spec/​models/​database_event_spec.rb Tests database event behavior.
spec/​factories/​venue.rb Adds venue factory.
spec/​factories/​user.rb Adds meetup-admin trait.
spec/​factories/​talk.rb Adds talk factory.
spec/​factories/​database_event.rb Adds database event factory.
sites/​melbourne/​spec/​requests/​events_controller_spec.rb Updates event request coverage.
sites/​melbourne/​spec/​requests/​database_events_controller_spec.rb Tests database event CRUD and authorization.
sites/​melbourne/​spec/​presenters/​database_event_presenter_spec.rb Tests presenter behavior.
sites/​melbourne/​config/​routes/​melbourne.rb Adds database event routes.
sites/​melbourne/​app/​views/​melbourne/​database_events/​show.html.erb Displays database event details.
sites/​melbourne/​app/​views/​melbourne/​database_events/​new.html.erb Adds new-event page.
sites/​melbourne/​app/​views/​melbourne/​database_events/​index.html.erb Lists database events.
sites/​melbourne/​app/​views/​melbourne/​database_events/​edit.html.erb Adds edit-event page.
sites/​melbourne/​app/​views/​melbourne/​database_events/​_talk.html.erb Renders talks.
sites/​melbourne/​app/​views/​melbourne/​database_events/​_form.html.erb Provides event form.
sites/​melbourne/​app/​views/​melbourne/​database_events/​_database_event.html.erb Provides event card partial.
sites/​melbourne/​app/​views/​melbourne/​database_events_home/​show.html.erb Displays database-backed homepage.
sites/​melbourne/​app/​views/​melbourne/​database_events_home/​_no_upcoming_summary.html.erb Provides empty-state content.
sites/​melbourne/​app/​views/​melbourne/​database_events_home/​_next_event.html.erb Renders the next event.
sites/​melbourne/​app/​views/​melbourne/​database_events_home/​_header.html.erb Provides homepage header.
sites/​melbourne/​app/​views/​layouts/​melbourne/​application.html.erb Loads Action Text assets.
sites/​melbourne/​app/​presenters/​event_presenter.rb Formats database event presentation and metadata.
sites/​melbourne/​app/​controllers/​database_events_home_controller.rb Loads database-backed homepage events.
sites/​melbourne/​app/​controllers/​database_events_controller.rb Implements database event CRUD.
db/​seeds/​users.rb Seeds meetup-admin access.
db/​schema.rb Records event-related schema changes.
db/​migrate/​20260721021825_create_events_and_import_from_yaml.rb Creates tables and imports YAML events.
CONTRIBUTING.md Documents meetup-admin development access.
app/​models/​venue.rb Adds venue model.
app/​models/​user.rb Adds meetup-admin scope.
app/​models/​talk.rb Adds talk model and parsing.
app/​models/​database_event.rb Adds database-backed event model and scopes.
app/​helpers/​meetup_admin_helper.rb Adds meetup-admin helper.
app/​frontend/​stylesheets/​melbourne_application.scss Loads Lexxy styling.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@HashNotAdam HashNotAdam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I wrote most of this feedback a month ago, so I hope its all still relevant

Comment thread app/models/talk.rb Resolved
kcomandich and others added 14 commits October 12, 2026 00:57
Add 'Edit' and 'Delete' buttons to database_events/show
Add 'Add New' button to database_events/index
…event_presenter

The times used to be hardcoded into the view, now they are in the database so they need formatting
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@kcomandich
kcomandich force-pushed the feature/events_architecture branch from edb394a to b293cd0 Compare October 11, 2026 11:57
Event page:
* Only show Youtube apology if talk is in the past

It looks a bit unusual when an event hasn't happened yet but we're
apologising for not having posted a recording

* Remove duplicate speaker names

Home page:
* Use the next event's start and end time rather than hard coding it

* Remove ununsed code checking for year_is_different_from_current_year?
* Descriptions will now be stored in the action_text_rich_texts rather than the events or talks
tables.

* When importing events from YAML and checking if a Talk is already imported, keep it simple and
don't search for talk by description (Action Text makes it more complicated to search)

* Action Text does not need to be sanitized, so remove the call to `sanitize` for the Talk
description. In the meta tags, the description is converted to plain text which must still be
sanitized:
https://guides.rubyonrails.org/action_text_overview.html#rendering-rich-text-content
https://api.rubyonrails.org/v8.1.3/classes/ActionText/Content.html#method-i-to_plain_text
* make Venues optional for DatabaseEvents
- update the views to account for this

* add a unique index to slug because it's used to identify event pages

* set_seeds_meetup_admin was incorrectly defined within import_yaml_events method

* generate an error if a Venue is destroyed that is associated with Event(s)

* specify some foreign_keys
@kcomandich
kcomandich force-pushed the feature/events_architecture branch from f714701 to 54dc052 Compare October 13, 2026 05:09
kcomandich and others added 3 commits October 13, 2026 18:13
Co-authored-by: Adam Rice <development@hashnotadam.com>
Instead of storing the date separately to the start_time, both in the
database as postgres datetime types, merge them together into
start_datetime.
@kcomandich kcomandich changed the title Events stored in the database instead of YAML files - first draft Events stored in the database instead of YAML files - steps 1-8 Oct 27, 2026
… Talks and DatabaseEvents

These records contain Action Text fields that aren't deleted otherwise, and when the
migration is run again it causes an error.
@kcomandich

Copy link
Copy Markdown
Contributor Author

This PR is ready to be merged. Can you merge it please @HashNotAdam or @leesheppard ?

It won't cause any user-viewable changes because these are new inaccessible pages and the old pages aren't using the new database records.

I've addressed all of the concerns raised, or created new issues for them to be resolved later.

See details at the top of the page, which I've updated based on my recent changes.

Next I'll work on:

  1. a PR for filtering by region and event_type
  2. address the remaining necessary issues in the "still to fix" list (ability to add/edit/delete Talks, Incorporate recent code changes)
  3. check that it's working again (step 8)
  4. create a PR for step 9

Thank you!!

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

5 participants