Sha256: b3453b0be18f236de96c16fe1729147023fda56ea6bd9c219eeeda38a8ea3e67

Contents?: true

Size: 517 Bytes

Versions: 4

Compression:

Stored size: 517 Bytes

Contents

module PagesCms
  class Image < ActiveRecord::Base
    belongs_to  :account
    mount_uploader :file, ImageUploader

    # has_many :slider_elements,  dependent: :nullify
    has_many :image_boxes,      dependent: :nullify
    has_many :articles,         dependent: :nullify
    has_many :thumbnails,       dependent: :nullify

    validate :has_account

    private
      def has_account
        if self.account.nil?
          errors.add(:base, 'Must be associated with an account')
        end
      end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pages_cms-2.4.2 app/models/pages_cms/image.rb
pages_cms-2.3.2 app/models/pages_cms/image.rb
pages_cms-2.3.1 app/models/pages_cms/image.rb
pages_cms-2.3.0 app/models/pages_cms/image.rb