Prevent responsible_name and question from validation
This commit is contained in:
@@ -49,8 +49,9 @@ class Legislation::ProposalsController < Legislation::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def proposal_params
|
def proposal_params
|
||||||
params.require(:legislation_proposal).permit(:legislation_process_id, :title, :question, :summary, :description, :external_url, :video_url,
|
params.require(:legislation_proposal).permit(:legislation_process_id, :title,
|
||||||
:responsible_name, :tag_list, :terms_of_service, :geozone_id,
|
:question, :summary, :description, :video_url, :tag_list,
|
||||||
|
:terms_of_service, :geozone_id,
|
||||||
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id] )
|
documents_attributes: [:id, :title, :attachment, :cached_attachment, :user_id] )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -25,15 +25,11 @@ class Legislation::Proposal < ActiveRecord::Base
|
|||||||
has_many :comments, as: :commentable
|
has_many :comments, as: :commentable
|
||||||
|
|
||||||
validates :title, presence: true
|
validates :title, presence: true
|
||||||
validates :question, presence: true
|
|
||||||
validates :summary, presence: true
|
validates :summary, presence: true
|
||||||
validates :author, presence: true
|
validates :author, presence: true
|
||||||
validates :responsible_name, presence: true
|
|
||||||
|
|
||||||
validates :title, length: { in: 4..Legislation::Proposal.title_max_length }
|
validates :title, length: { in: 4..Legislation::Proposal.title_max_length }
|
||||||
validates :description, length: { maximum: Legislation::Proposal.description_max_length }
|
validates :description, length: { maximum: Legislation::Proposal.description_max_length }
|
||||||
validates :question, length: { in: 10..Legislation::Proposal.question_max_length }
|
|
||||||
validates :responsible_name, length: { in: 6..Legislation::Proposal.responsible_name_max_length }
|
|
||||||
|
|
||||||
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
validates :terms_of_service, acceptance: { allow_nil: false }, on: :create
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user