rosa-build/app/models/project_import.rb

12 lines
380 B
Ruby
Raw Normal View History

class ProjectImport < ActiveRecord::Base
belongs_to :project
belongs_to :platform
2014-01-21 04:51:49 +00:00
validates :name, uniqueness: {scope: :platform_id, case_sensitive: false}
validates :name, :platform_id, :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