Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
yuetylauiris committed Oct 24, 2023
1 parent ff23073 commit ae82340
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/models/featured_image_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ class FeaturedImageData < ApplicationRecord
validates :file, presence: true, if: :image_changed?
validates_with ImageValidator, size: [960, 640], if: :image_changed?

has_many :assets,
as: :assetable,
inverse_of: :assetable

private

def image_changed?
Expand Down
4 changes: 2 additions & 2 deletions app/models/organisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class Organisation < ApplicationRecord
DEFAULT_JOBS_URL = "https://www.civilservicejobs.service.gov.uk/csr".freeze
FEATURED_DOCUMENTS_DISPLAY_LIMIT = 6

belongs_to :default_news_image_legacy, class_name: "DefaultNewsOrganisationImageData", foreign_key: :default_news_organisation_image_data_id
belongs_to :default_news_image, class_name: "FeaturedImageData", foreign_key: :featured_image_data_id
belongs_to :default_news_image, class_name: "DefaultNewsOrganisationImageData", foreign_key: :default_news_organisation_image_data_id
belongs_to :default_news_image_new, class_name: "FeaturedImageData", foreign_key: :featured_image_data_id

has_many :assets,
as: :assetable,
Expand Down

0 comments on commit ae82340

Please sign in to comment.