diff --git a/app/models/event.rb b/app/models/event.rb index 5049698..ac9565c 100644 --- a/app/models/event.rb +++ b/app/models/event.rb @@ -8,7 +8,7 @@ class Event < ApplicationRecord ORGANIZATIONS = ORGANIZATIONS_BY_TYPE.values.flatten.uniq validates :name, :location, :datetime, :link, presence: true - validates :name, uniqueness: { scope: [:datetime, :organization] } + validates :name, uniqueness: { scope: [ :datetime, :organization ] } validates :organization, inclusion: { in: ORGANIZATIONS } scope :published, -> { where.not(approved_at: nil).or(where(source: :scraper)) } @@ -17,5 +17,5 @@ class Event < ApplicationRecord def date = datetime.to_date - def source_enum = [:scraper, :webform] # for rails_admin + def source_enum = [ :scraper, :webform ] # for rails_admin end diff --git a/config/initializers/rails_admin.rb b/config/initializers/rails_admin.rb index a40691a..088450f 100644 --- a/config/initializers/rails_admin.rb +++ b/config/initializers/rails_admin.rb @@ -2,8 +2,8 @@ config.asset_source = :sprockets config.authenticate_with do - authenticate_or_request_with_http_basic('Login required') do |username, password| - username == 'admin' && ActiveSupport::SecurityUtils.secure_compare(password, ENV['ADMIN_PASSWORD']) + authenticate_or_request_with_http_basic("Login required") do |username, password| + username == "admin" && ActiveSupport::SecurityUtils.secure_compare(password, ENV["ADMIN_PASSWORD"]) end end @@ -21,7 +21,7 @@ config.model Event do list do - scopes [nil, :published, :to_approve, :approved] + scopes [ nil, :published, :to_approve, :approved ] end end end diff --git a/config/routes.rb b/config/routes.rb index 8829094..9092bf2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,5 +1,5 @@ Rails.application.routes.draw do - mount RailsAdmin::Engine => '/admin', as: 'rails_admin' + mount RailsAdmin::Engine => "/admin", as: "rails_admin" # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500. diff --git a/db/migrate/20241031101411_adds_approved_at_to_events.rb b/db/migrate/20241031101411_adds_approved_at_to_events.rb index e76fb00..a332fd9 100644 --- a/db/migrate/20241031101411_adds_approved_at_to_events.rb +++ b/db/migrate/20241031101411_adds_approved_at_to_events.rb @@ -1,6 +1,6 @@ class AddsApprovedAtToEvents < ActiveRecord::Migration[7.2] def change - create_enum :event_source, %w(scraper webform) + create_enum :event_source, %w[scraper webform] add_column :events, :approved_at, :datetime add_column :events, :source, :event_source