From f23fd927d6461346eac4e71a6ba744af8f2b0d61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sen=C3=A9n=20Rodero=20Rodr=C3=ADguez?= Date: Mon, 26 Jun 2017 15:55:35 +0200 Subject: [PATCH] Add constant to set minimum size for budget investment image. --- app/models/budget/investment.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index b8bf690bc..2f86ed190 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -1,5 +1,7 @@ class Budget class Investment < ActiveRecord::Base + MIN_SIZE = 475 + include Measurable include Sanitizable include Taggable @@ -17,7 +19,7 @@ class Budget acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases - has_attached_file :image, styles: { large: "x475", medium: "300x300#", thumb: "140x245#" } + has_attached_file :image, styles: { large: "x#{MIN_SIZE}", medium: "300x300#", thumb: "140x245#" } belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id' belongs_to :heading @@ -279,7 +281,7 @@ class Budget width = dimensions.width height = dimensions.height - if width < 475 || height < 475 + if width < MIN_SIZE || height < MIN_SIZE errors['image'] << I18n.t("budgets.investments.edit_image.invalid_dimmensions") end end