Submit social housing lettings and sales data (CORE)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

11 lines
481 B

class CsvVariableDefinition < ApplicationRecord
validates :variable, presence: true
validates :definition, presence: true
validates :log_type, presence: true, inclusion: { in: %w[lettings sales] }
validates :year, presence: true, numericality: { only_integer: true, greater_than_or_equal_to: 2000, less_than_or_equal_to: 2099 }
attribute :last_accessed, :datetime
scope :lettings, -> { where(log_type: "lettings") }
scope :sales, -> { where(log_type: "sales") }
end