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-03-11 12:40:44 +00:00
|
|
|
validates :name, uniqueness: { scope: :platform_id, case_sensitive: false }
|
2014-01-21 04:51:49 +00:00
|
|
|
validates :name, :platform_id, :version, presence: true
|
2012-01-28 02:05:31 +00:00
|
|
|
|
2014-03-11 07:39:25 +00:00
|
|
|
scope :by_name, ->(name) { where("#{table_name}.name ILIKE ?", name) }
|
2012-01-28 01:04:11 +00:00
|
|
|
|
2014-03-11 08:58:36 +00:00
|
|
|
after_initialize ->(r) { r.file_mtime ||= Time.current - 10.years } # default
|
2012-01-27 15:35:18 +00:00
|
|
|
end
|