Commit 057ea3f4 authored by Kaspar Vollenweider's avatar Kaspar Vollenweider 👻 Committed by Kaspar
Browse files

shorten nested attributes concerns by including key, so including them is shorter

parent 040d56db
......@@ -23,7 +23,7 @@ Style/LineEndConcatenation:
Style/FrozenStringLiteralComment:
Enabled: false
Style/MultilineOperationIndentation:
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
Style/AsciiComments:
......@@ -49,7 +49,7 @@ Metrics/BlockLength:
Exclude:
- 'test/system/*'
Style/AlignHash:
Layout/AlignHash:
EnforcedLastArgumentHashStyle: ignore_implicit
Style/ClassAndModuleChildren:
......@@ -58,7 +58,7 @@ Style/ClassAndModuleChildren:
Style/SymbolArray:
EnforcedStyle: brackets
Style/AlignParameters:
Layout/AlignParameters:
EnforcedStyle: with_fixed_indentation
Style/RegexpLiteral:
......
......@@ -49,11 +49,11 @@ class ClientsController < ApplicationController
end
def client_params
params.require(:client).permit(:id, :first_name, :last_name, :date_of_birth, :nationality,
params.require(:client).permit(
:id, :first_name, :last_name, :date_of_birth, :nationality,
:permit, :gender, :street, :zip, :city, :phone, :email, :goals, :education, :hobbies,
:interests, :state, :comments, :competent_authority, :involved_authority, :user_id,
language_skills_attributes: language_skills_attributes,
relatives_attributes: relatives_attributes,
schedules_attributes: schedules_attributes)
language_skills_attributes, relatives_attributes, schedules_attributes
)
end
end
......@@ -12,15 +12,21 @@ module NestedAttributes
end
def language_skills_attributes
[:id, :language, :level, :_destroy]
{
language_skills_attributes: [:id, :language, :level, :_destroy]
}
end
def relatives_attributes
[:id, :first_name, :last_name, :date_of_birth, :relation, :_destroy]
{
relatives_attributes: [:id, :first_name, :last_name, :date_of_birth, :relation, :_destroy]
}
end
def schedules_attributes
[:id, :day, :time, :available]
{
schedules_attributes: [:id, :day, :time, :available]
}
end
end
end
......@@ -22,9 +22,9 @@ class VolunteerApplicationsController < ApplicationController
def volunteer_params
params.require(:volunteer).permit(
volunteer_attributes,
language_skills_attributes: language_skills_attributes,
relatives_attributes: relatives_attributes,
schedules_attributes: schedules_attributes)
volunteer_attributes: volunteer_attributes.push(
language_skills_attributes, relatives_attributes, schedules_attributes
)
)
end
end
......@@ -60,11 +60,13 @@ class VolunteersController < ApplicationController
authorize @volunteer
end
def volunteer_params
params.require(:volunteer).permit(
volunteer_attributes,
language_skills_attributes: language_skills_attributes,
relatives_attributes: relatives_attributes,
schedules_attributes: schedules_attributes)
volunteer_attributes.push(
language_skills_attributes, relatives_attributes, schedules_attributes
)
)
end
end
......@@ -47,20 +47,20 @@
= render 'relatives/form', f: f, relative: @volunteer
.row
.col-xs-12
= f.input :profession
= f.input :education
= f.input :motivation
= f.input :experience
= f.input :expectations
= f.input :strengths
= f.input :skills
= f.input :interests
.row
.col-xs-12
= f.input :profession
= f.input :education
= f.input :motivation
= f.input :experience
= f.input :expectations
= f.input :strengths
= f.input :skills
= f.input :interests
.row
.col-xs-12
= f.input :state, collection: Volunteer.state_collection
.row
.col-xs-12
= f.input :state, collection: Volunteer.state_collection
- if policy(Volunteer).destroy?
.row
......
require 'test_helper'
require 'capybara/poltergeist'
DIMENSIONS = [1400, 3200].freeze
DIMENSIONS = [1400, 4000].freeze
Capybara.register_driver :poltergeist_debug do |app|
Capybara::Poltergeist::Driver.new(
......
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