Skip to content

Commit

Permalink
allow delete community
Browse files Browse the repository at this point in the history
  • Loading branch information
tvcam committed Dec 25, 2020
1 parent 63e6b38 commit 31095b2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions app/controllers/communities_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ def update
end

def destroy
# if @community.current_clients.blank? && (@community.cases.present? && @community.cases.delete_all || true) && @community.destroy
# redirect_to families_url, notice: t('.successfully_deleted')
# else
# redirect_to family_path(@community), alert: t('.alert')
# end
if @community.destroy
redirect_to communities_path, notice: t('.successfully_deleted')
else
redirect_to community_path(@community), alert: t('.alert')
end
end

# def version
Expand Down
2 changes: 1 addition & 1 deletion app/models/community_member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CommunityMember < ActiveRecord::Base

enumerize :gender, in: ['female', 'male', 'lgbt', 'unknown', 'prefer_not_to_say', 'other'], scope: :shallow, predicates: { prefix: true }

after_commit :save_family_data
after_commit :save_family_data, if: :persisted?

def self.update_family_relevant_data(family_member_id)
find(family_member_id).save_family_data
Expand Down

0 comments on commit 31095b2

Please sign in to comment.