users can create spending proposals

This commit is contained in:
Juanjo Bazán
2016-01-04 21:44:13 +01:00
parent 8b8c1feab7
commit 54badef191
9 changed files with 202 additions and 6 deletions

View File

@@ -3,14 +3,16 @@ class SpendingProposal < ActiveRecord::Base
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..Proposal.title_max_length }
validates :description, length: { maximum: Proposal.description_max_length }
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