Skip to content

Commit f8786a3

Browse files
committed
WIP migrate all models to active storage
1 parent 81e1ef7 commit f8786a3

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

app/models/scheduled_show.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ class ScheduledShow < ActiveRecord::Base
1818
validate_media_type: false # TODO comment out for prod
1919
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
2020

21+
# TODO will rename to image when migration completes
22+
has_one_attached :as_image
23+
2124
has_many :scheduled_show_labels, dependent: :destroy
2225
has_many :labels, through: :scheduled_show_labels
2326

app/models/show_series.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ class ShowSeries < ApplicationRecord
1212

1313
has_many :episodes, class_name: "::ScheduledShow"
1414

15-
# TODO move to active storage I guess?
16-
# has_one_attached :image
1715
has_attached_file :image,
1816
styles: { :thumb => "x300", :medium => "x600" },
1917
path: ":attachment/:style/:basename.:extension",
2018
validate_media_type: false # TODO comment out for prod
2119
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
2220

21+
has_one_attached :as_image
22+
2323
enum status: [:active, :archived, :disabled]
2424

2525
enum recurring_interval: [:not_recurring, :day, :week, :month, :year, :biweek]

app/models/track.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class Track < ActiveRecord::Base
2323
path: ":attachment/:style/:basename.:extension"
2424

2525
validates_attachment_content_type :artwork, content_type: /\Aimage\/.*\Z/
26+
has_one_attached :as_image
2627

2728
# Prevent duplicate audio files for the same scheduled show
2829
validates :audio_file_name, uniqueness: { scope: :scheduled_show_id,

app/models/user.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class User < ActiveRecord::Base
2525
has_attached_file :image, styles: { :thumb => "150x150#", :medium => "250x250#" },
2626
path: ":attachment/:style/:basename.:extension"
2727
validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/
28+
has_one_attached :as_image
2829

2930
default_scope { order(created_at: :desc) }
3031

0 commit comments

Comments
 (0)