Files
nairobi/app/models/concerns/measurable.rb
2016-11-30 13:38:13 +01:00

25 lines
477 B
Ruby

module Measurable
extend ActiveSupport::Concern
class_methods do
def title_max_length
@@title_max_length ||= (self.columns.find { |c| c.name == 'title' }.limit rescue nil) || 80
end
def responsible_name_max_length
@@responsible_name_max_length ||= (self.columns.find { |c| c.name == 'responsible_name' }.limit rescue nil) || 60
end
def question_max_length
140
end
def description_max_length
6000
end
end
end