diff --git a/app/models/budget/investment.rb b/app/models/budget/investment.rb index 2f86ed190..640274cc6 100644 --- a/app/models/budget/investment.rb +++ b/app/models/budget/investment.rb @@ -1,7 +1,5 @@ class Budget class Investment < ActiveRecord::Base - MIN_SIZE = 475 - include Measurable include Sanitizable include Taggable @@ -19,7 +17,6 @@ class Budget acts_as_paranoid column: :hidden_at include ActsAsParanoidAliases - 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 @@ -42,10 +39,6 @@ class Budget validates :title, length: { in: 4..Budget::Investment.title_max_length } validates :description, length: { maximum: Budget::Investment.description_max_length } validates :terms_of_service, acceptance: { allow_nil: false }, on: :create - validates_attachment :image, content_type: { content_type: ["image/jpeg"] } - validates :image_title, presence: true, if: -> { image.present? } - validates :image_title, length: { in: 4..Budget::Investment.title_max_length }, if: -> { image.present? } - validate :check_image_dimensions scope :sort_by_confidence_score, -> { reorder(confidence_score: :desc, id: :desc) } scope :sort_by_ballots, -> { reorder(ballot_lines_count: :desc, id: :desc) } @@ -274,18 +267,5 @@ class Budget self.budget_id ||= heading.try(:group).try(:budget_id) end - def check_image_dimensions - temp_file = image.queued_for_write[:original] - unless temp_file.nil? - dimensions = Paperclip::Geometry.from_file(temp_file) - width = dimensions.width - height = dimensions.height - - if width < MIN_SIZE || height < MIN_SIZE - errors['image'] << I18n.t("budgets.investments.edit_image.invalid_dimmensions") - end - end - end - end end