Commit 870d5a06 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻 Committed by Kaspar
Browse files

cleanup mess with permitted attribute concerns

parent 598c0cbe
......@@ -2,14 +2,6 @@ module NestedAttributes
extend ActiveSupport::Concern
included do
def volunteer_attributes
[:date_of_birth, :gender, :avatar, :nationality, :additional_nationality,
:profession, :education, :motivation, :experience, :expectations,
:strengths, :skills, :interests, :state, :rejection_type, :rejection_text,
:duration, :man, :woman, :family, :kid, :sport, :creative, :music, :culture,
:training, :german_course, :adults, :teenagers, :children, :region]
end
def language_skills_attributes
{
language_skills_attributes: [:id, :language, :level, :_destroy]
......
......@@ -2,7 +2,6 @@ module VolunteerAttributes
extend ActiveSupport::Concern
included do
include ContactAttributes
def volunteer_attributes
[
:date_of_birth, :gender, :avatar, :nationality, :additional_nationality,
......@@ -10,7 +9,6 @@ module VolunteerAttributes
:strengths, :skills, :interests, :state, :duration, :man, :woman,
:family, :kid, :sport, :creative, :music, :culture, :training,
:german_course, :adults, :teenagers, :children, :region, :state,
:first_language, :title, :first_name, :last_name,
contact_attributes, language_skills_attributes, schedules_attributes
]
end
......
class VolunteerApplicationsController < ApplicationController
include NestedAttributes
include VolunteerAttributes
include ContactAttributes
include VolunteerAttributes
skip_before_action :authenticate_user!
def new
......@@ -11,7 +11,6 @@ class VolunteerApplicationsController < ApplicationController
end
def create
volunteer_params[:state] = 'registered'
@volunteer = Volunteer.new(volunteer_params)
if @volunteer.save
redirect_to thanks_volunteer_applications_url
......@@ -25,9 +24,6 @@ class VolunteerApplicationsController < ApplicationController
private
def volunteer_params
params.require(:volunteer).permit(
volunteer_attributes, language_skills_attributes, schedules_attributes,
contact_attributes
)
params.require(:volunteer).permit(volunteer_attributes)
end
end
class VolunteersController < ApplicationController
include NestedAttributes
include ContactAttributes
include VolunteerAttributes
before_action :set_volunteer, only: [:show, :edit, :update, :destroy]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment