CRUD html_map_coordinates geozone attribute

This commit is contained in:
Alberto Miedes Garcés
2016-12-08 16:50:36 +01:00
parent 6b53020185
commit 60da2a875b
5 changed files with 13 additions and 10 deletions

View File

@@ -33,15 +33,10 @@ class Admin::GeozonesController < Admin::BaseController
end
def destroy
# Check that in none of the other associated models talbes a record exists
# Check that in none of the other associated models tables a record exists
# referencing this geozone
safe_to_destroy = true
# safe_to_destroy &= Proposal.where(geozone: @geozone).empty?
# safe_to_destroy &= Debate.where(geozone: @geozone).empty?
# safe_to_destroy &= SpendingProposal.where(geozone: @geozone).empty?
# safe_to_destroy &= User.where(geozone: @geozone).empty?
Geozone.reflect_on_all_associations.each do |association|
attached_model = association.klass
safe_to_destroy &= attached_model.where(geozone: @geozone).empty?
@@ -58,6 +53,6 @@ class Admin::GeozonesController < Admin::BaseController
private
def geozone_params
params.require(:geozone).permit(:name, :external_code, :census_code)
params.require(:geozone).permit(:name, :external_code, :census_code, :html_map_coordinates)
end
end