mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Use strong parameters for user in admin/registrations#update
This commit is contained in:
parent
6bcecbd219
commit
9fe7d0ca7c
2 changed files with 7 additions and 5 deletions
|
|
@ -14,8 +14,7 @@ module Admin
|
|||
def edit; end
|
||||
|
||||
def update
|
||||
@user.update_attributes(registration_params[:user_attributes])
|
||||
params[:registration].delete :user_attributes
|
||||
@user.update_attributes(user_params)
|
||||
|
||||
@registration.update_attributes(registration_params)
|
||||
if @registration.save
|
||||
|
|
@ -54,11 +53,14 @@ module Admin
|
|||
@user = User.find_by(id: @registration.user_id)
|
||||
end
|
||||
|
||||
def user_params
|
||||
params.require(:user).permit(:name, :nickname, :affiliation)
|
||||
end
|
||||
|
||||
def registration_params
|
||||
params.require(:registration).permit(:user_id, :conference_id, :arrival, :departure, :attended,
|
||||
:volunteer, :other_special_needs,
|
||||
vchoice_ids: [], qanswer_ids: [], qanswers_attributes: [], event_ids: [],
|
||||
user_attributes: [:nickname, :name, :affiliation, :tshirt, :mobile, :volunteer_experience, :languages])
|
||||
vchoice_ids: [], qanswer_ids: [], qanswers_attributes: [], event_ids: [])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
.col-md-6
|
||||
= semantic_form_for(@registration, url: admin_conference_registration_path(@conference.short_title, @registration)) do |f|
|
||||
= f.inputs 'Personal Information' do
|
||||
= f.fields_for :user do |u|
|
||||
= semantic_fields_for :user do |u|
|
||||
= u.input :name, as: :string
|
||||
= u.input :nickname, as: :string
|
||||
= u.input :affiliation, placeholder: 'Company/User Group/nothing', as: :string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue