Sha256: f1f46536a4b29e2de63f2bf734494c99243e5f88b6a116d7d2aa31351da0de15

Contents?: true

Size: 662 Bytes

Versions: 1

Compression:

Stored size: 662 Bytes

Contents

# == Schema Information
#
# Table name: project_attachments
#
#  id           :integer          not null, primary key
#  project_id   :integer          not null
#  file         :string(255)
#  created_at   :datetime
#  updated_at   :datetime
#  finish_id    :integer
#  content_type :string(255)
#

class ProjectAttachment < ActiveRecord::Base
  belongs_to :project
  belongs_to :finish

  validates :file, presence: true
  validates :project, presence: true
  validates :finish, allow_blank: true,
    inclusion: {
      in: proc { |record| record.project ? record.project.finishes : [nil] }
    }

  def image?
    content_type.starts_with? "image"
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
self_systeem-0.1.0 test/dummy_app/app/models/project_attachment.rb