Commit be54b7d5 authored by Tugce Nur Tas's avatar Tugce Nur Tas Committed by Tuğçe Nur Taş
Browse files

move volunteer params into concern but not working

parent 6db351b1
......@@ -2,6 +2,15 @@ module NestedAttributes
extend ActiveSupport::Concern
included do
def volunteer_attributes
[:first_name, :last_name, :date_of_birth, :gender, :avatar, :street,
:zip, :city, :nationality, :additional_nationality, :email, :phone,
:profession, :education, :motivation, :experience, :expectations,
:strengths, :skills, :interests, :state, :duration, :man, :woman,
:family, :kid, :sport, :creative, :music, :culture, :training,
:german_course, :adults, :teenagers, :children, :region]
end
def language_skills_attributes
[:id, :language, :level, :_destroy]
end
......
class VolunteerApplicationsController < ApplicationController
include NestedAttributes
skip_before_action :authenticate_user!
def new
......@@ -19,10 +20,10 @@ class VolunteerApplicationsController < ApplicationController
private
def volunteer_params
params.require(:volunteer).permit(:first_name, :last_name, :date_of_birth, :gender, :avatar,
:street, :zip, :city, :nationality, :additional_nationality, :email, :phone, :profession,
:education, :motivation, :experience, :expectations, :strengths, :skills, :interests, :state,
:duration, :man, :woman, :family, :kid, :sport, :creative, :music, :culture, :training,
:german_course, :adults, :teenagers, :children, :region)
params.require(:volunteer).permit(
volunteer_attributes: volunteer_attributes,
language_skills_attributes: language_skills_attributes,
relatives_attributes: relatives_attributes,
schedules_attributes: schedules_attributes)
end
end
......@@ -44,13 +44,10 @@ class VolunteersController < ApplicationController
end
def volunteer_params
params.require(:volunteer).permit(:first_name, :last_name, :date_of_birth, :gender, :avatar,
:street, :zip, :city, :nationality, :additional_nationality, :email, :phone, :profession,
:education, :motivation, :experience, :expectations, :strengths, :skills, :interests, :state,
:duration, :man, :woman, :family, :kid, :sport, :creative, :music, :culture, :training,
:german_course, :adults, :teenagers, :children, :region,
language_skills_attributes: language_skills_attributes,
relatives_attributes: relatives_attributes,
schedules_attributes: schedules_attributes)
params.require(:volunteer).permit(
volunteer_attributes: volunteer_attributes,
language_skills_attributes: language_skills_attributes,
relatives_attributes: relatives_attributes,
schedules_attributes: schedules_attributes)
end
end
Supports Markdown
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