Files
grecia/app/models/spending_proposal.rb
2016-01-11 12:17:10 +01:00

19 lines
574 B
Ruby

class SpendingProposal < ActiveRecord::Base
include Measurable
include Sanitizable
include Taggable
apply_simple_captcha
belongs_to :author, -> { with_hidden }, class_name: 'User', foreign_key: 'author_id'
validates :title, presence: true
validates :author, presence: true
validates :description, presence: true
validates :title, length: { in: 4..SpendingProposal.title_max_length }
validates :description, length: { maximum: SpendingProposal.description_max_length }
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
end