Skip to content
This repository was archived by the owner on Jun 27, 2023. It is now read-only.

Commit 08bb3d2

Browse files
committed
accepts nested attributes form for postal address
1 parent 549d370 commit 08bb3d2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

app/controllers/users_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ def user_params
107107
:application_learning_history, :application_skills, :application_code_samples,
108108
:application_location, :application_minimum_money, :application_money, :application_goals, :application_code_background,
109109
interested_in: [],
110-
roles_attributes: [:id, :name, :team_id, :_destroy]
110+
roles_attributes: [:id, :name, :team_id, :_destroy],
111+
postal_address_attributes: [:address_line_1, :address_line_2, :city, :state_or_province, :country]
111112
)
112113
end
113114
end

app/views/users/edit.html.slim

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,14 @@
107107
p.help-block This information will only be visible to yourself and the organizers.
108108
= f.input :tshirt_size, as: :select, collection: User::TSHIRT_SIZES.map { |k| [k, k] }, label: 'T-Shirt size', blank: false, required: false, hint: 'For sponsor T-Shirts, in case they send some.'
109109
= f.input :tshirt_cut, as: :select, collection: User::TSHIRT_CUTS.map { |s| [s, s] }, label: 'T-Shirt cut', include_blank: true
110-
= f.input :postal_address, hint: "Please give your postal address, including your full name, so we can send things we've received from our sponsors for you :)"
110+
h4 Shipping Address
111+
= f.simple_fields_for :postal_addresses do |pa|
112+
= pa.input :address_line_1, required: false
113+
= pa.input :address_line_2, required: false
114+
= pa.input :city, required: false
115+
= pa.input :state_or_province, required: false
116+
= pa.input :country, required: false
117+
111118

112119
- if admin?
113120
h3.page-header Roles

0 commit comments

Comments
 (0)