rosa-build/app/models/project_import.rb

13 lines
426 B
Ruby
Raw Normal View History

2012-01-30 20:39:34 +00:00
# -*- encoding : utf-8 -*-
class ProjectImport < ActiveRecord::Base
belongs_to :project
belongs_to :platform
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