This commit is contained in:
Albert Yi 2018-07-20 11:51:42 -07:00
parent a06a387725
commit 93f52adc81

View File

@ -54,13 +54,13 @@ class WikiPagesController < ApplicationController
end
def create
@wiki_page = WikiPage.create(wiki_page_params)
@wiki_page = WikiPage.create(wiki_page_create_params)
respond_with(@wiki_page)
end
def update
@wiki_page = WikiPage.find(params[:id])
@wiki_page.update(wiki_page_params)
@wiki_page.update(wiki_page_update_params)
respond_with(@wiki_page)
end
@ -98,10 +98,18 @@ class WikiPagesController < ApplicationController
end
end
def wiki_page_params
def wiki_page_create_params
permitted_params = %i[title body other_names skip_secondary_validations]
permitted_params += %i[is_locked is_deleted] if 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