rosa-build/app/models/project_import.rb

12 lines
379 B
Ruby
Raw Normal View History

class ProjectImport < ActiveRecord::Base
belongs_to :project
belongs_to :platform
2014-03-11 12:40:44 +00:00
validates :name, uniqueness: { scope: :platform_id, case_sensitive: false }
validates :name, :platform, :version, presence: true
scope :by_name, ->(name) { where("#{table_name}.name ILIKE ?", name) }
after_initialize ->(r) { r.file_mtime ||= Time.current - 10.years } # default
end