2012-01-30 20:39:34 +00:00
|
|
|
# -*- encoding : utf-8 -*-
|
2012-01-27 15:35:18 +00:00
|
|
|
class ProjectImport < ActiveRecord::Base
|
|
|
|
belongs_to :project
|
2012-01-31 18:48:37 +00:00
|
|
|
belongs_to :platform
|
2012-01-27 15:35:18 +00:00
|
|
|
|
2012-01-31 18:48:37 +00:00
|
|
|
validates :name, :uniqueness => {:scope => :platform_id, :case_sensitive => false}
|
|
|
|
validates :name, :platform_id, :version, :presence => true
|
2012-01-28 02:05:31 +00:00
|
|
|
|
2012-01-28 01:04:11 +00:00
|
|
|
scope :by_name, lambda {|name| where('project_imports.name ILIKE ?', name)}
|
|
|
|
|
2012-01-27 15:35:18 +00:00
|
|
|
after_initialize lambda {|r| r.file_mtime ||= Time.current - 10.years } # default
|
|
|
|
end
|