|
|
@ -29,6 +29,11 @@ class OrganisationRelationshipsController < ApplicationController |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def create |
|
|
|
def create |
|
|
|
|
|
|
|
@resource = OrganisationRelationship.new |
|
|
|
|
|
|
|
if params["related_organisation_id"] == nil |
|
|
|
|
|
|
|
@resource.errors.add :housing_providers, "Select a housing provider" |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
end |
|
|
|
@resource = OrganisationRelationship.new(child_organisation_id: @organisation.id, parent_organisation_id: related_organisation_params, relationship_type: 0) |
|
|
|
@resource = OrganisationRelationship.new(child_organisation_id: @organisation.id, parent_organisation_id: related_organisation_params, relationship_type: 0) |
|
|
|
@resource.save! |
|
|
|
@resource.save! |
|
|
|
redirect_to housing_providers_organisation_path |
|
|
|
redirect_to housing_providers_organisation_path |
|
|
@ -40,10 +45,6 @@ private |
|
|
|
@organisation ||= Organisation.find(params[:id]) |
|
|
|
@organisation ||= Organisation.find(params[:id]) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def related_organisation |
|
|
|
|
|
|
|
Organisation.find(params[:related_organisation_id]) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def related_organisation_params |
|
|
|
def related_organisation_params |
|
|
|
params.require(:related_organisation_id) |
|
|
|
params.require(:related_organisation_id) |
|
|
|
end |
|
|
|
end |
|
|
|