DRY CLIENT_FIELDS
This commit is contained in:
@@ -64,6 +64,9 @@ class ProjectsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
CLIENT_FIELDS = [:company_name, :firstname, :lastname, :streetname, :zipcode, :city, :country, :email, :phone]
|
||||||
|
|
||||||
# Use callbacks to share common setup or constraints between actions.
|
# Use callbacks to share common setup or constraints between actions.
|
||||||
def set_project
|
def set_project
|
||||||
@project = Project.find(params.expect(:id))
|
@project = Project.find(params.expect(:id))
|
||||||
@@ -75,9 +78,9 @@ class ProjectsController < ApplicationController
|
|||||||
:name, :email, :short_name,
|
:name, :email, :short_name,
|
||||||
subprojects_attributes: [
|
subprojects_attributes: [
|
||||||
:id, :subproject_name, :client_id, :owner_id, :builder_id, :_destroy,
|
:id, :subproject_name, :client_id, :owner_id, :builder_id, :_destroy,
|
||||||
client_attributes: [:company_name, :firstname, :lastname, :streetname, :zipcode, :city, :country, :email, :phone],
|
client_attributes: CLIENT_FIELDS,
|
||||||
owner_attributes: [:company_name, :firstname, :lastname, :streetname, :zipcode, :city, :country, :email, :phone],
|
owner_attributes: CLIENT_FIELDS,
|
||||||
builder_attributes: [:company_name, :firstname, :lastname, :streetname, :zipcode, :city, :country, :email, :phone]
|
builder_attributes: CLIENT_FIELDS
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user