rosa-build/app/models/project_import.rb

12 lines
387 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
2013-02-28 15:27:50 +00:00
scope :by_name, lambda {|name| where("#{table_name}.name ILIKE ?", name)}
after_initialize lambda {|r| r.file_mtime ||= Time.current - 10.years } # default
end