Skip to content

Commit

Permalink
Added file size limit for home background image.
Browse files Browse the repository at this point in the history
  • Loading branch information
SarahW91 committed Feb 15, 2023
1 parent ca54a75 commit 735426d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/models/home.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Home < ApplicationRecord
belongs_to :main_logo, class_name: 'Logo', foreign_key: :main_logo_id, dependent: :destroy

has_one_attached :background_image
validates :background_image, content_type: [:jpg, :png, :svg]
validates :background_image, content_type: [:jpg, :png, :svg], size: { less_than: 1.megabytes , message: 'is too large. Please upload an image with a filesize < 1MB' }

validates_presence_of :title
validates_length_of :logos, :maximum => 12, message: 'You can only add a maximum of 12 logos'
Expand Down

0 comments on commit 735426d

Please sign in to comment.