Merge pull request #3989 from evazion/fix-3987

Wiki pages: convert other_names column to array (#3987)
This commit is contained in:
Albert Yi
2018-11-19 16:23:32 -08:00
committed by GitHub
27 changed files with 238 additions and 181 deletions

View File

@@ -105,7 +105,7 @@ private
end
def artist_params
permitted_params = %i[name other_names other_names_comma group_name url_string notes]
permitted_params = %i[name other_names other_names_string group_name url_string notes]
permitted_params << :is_active if CurrentUser.is_builder?
params.fetch(:artist, {}).permit(permitted_params)

View File

@@ -96,7 +96,7 @@ class PoolsController < ApplicationController
private
def pool_params
permitted_params = %i[name description category is_active post_ids]
permitted_params = %i[name description category is_active post_ids post_ids_string]
params.require(:pool).permit(*permitted_params, post_ids: [])
end
end

View File

@@ -5,7 +5,7 @@ class WikiPagesController < ApplicationController
before_action :normalize_search_params, :only => [:index]
def new
@wiki_page = WikiPage.new(wiki_page_create_params)
@wiki_page = WikiPage.new(wiki_page_params(:create))
respond_with(@wiki_page)
end
@@ -54,13 +54,13 @@ class WikiPagesController < ApplicationController
end
def create
@wiki_page = WikiPage.create(wiki_page_create_params)
@wiki_page = WikiPage.create(wiki_page_params(:create))
respond_with(@wiki_page)
end
def update
@wiki_page = WikiPage.find(params[:id])
@wiki_page.update(wiki_page_update_params)
@wiki_page.update(wiki_page_params(:update))
respond_with(@wiki_page)
end
@@ -98,18 +98,11 @@ class WikiPagesController < ApplicationController
end
end
def wiki_page_create_params
permitted_params = %i[title body other_names skip_secondary_validations]
def wiki_page_params(context)
permitted_params = %i[body other_names other_names_string skip_secondary_validations]
permitted_params += %i[is_locked is_deleted] if CurrentUser.is_builder?
permitted_params += %i[title] if context == :create || CurrentUser.is_builder?
params.fetch(:wiki_page, {}).permit(permitted_params)
end
def wiki_page_update_params
permitted_params = %i[body other_names skip_secondary_validations]
permitted_params += %i[title is_locked is_deleted] if CurrentUser.is_builder?
params.fetch(:wiki_page, {}).permit(permitted_params)
end
end