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
|
|
|
|
2014-01-21 04:51:49 +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
|
|
|
|
2013-02-28 15:27:50 +00:00
|
|
|
scope :by_name, lambda {|name| where("#{table_name}.name ILIKE ?", name)}
|
2012-01-28 01:04:11 +00:00
|
|
|
|
2012-01-27 15:35:18 +00:00
|
|
|
after_initialize lambda {|r| r.file_mtime ||= Time.current - 10.years } # default
|
|
|
|
end
|