'Receiving NoMethod association error when canceling an account in Ruby
Have two role permissions setup on registration: applicant and company. The account is deleting from the records in the terminal but is receiving a "Completed 500 Internal Server Error." This is occurring in development mode.
Using Devise for authentication and when going to cancel an account after logging in, the following error message below is presented.

User Model Method for Subscriptions
def subscribed?
subscriptions.where(status: 'active').any?
end
Would like to fully understand why the above error is occurring and how to resolve it.
Solution 1:[1]
I would look into This answer here. I was dealing with the same issue the other day, and the fix for me happened to me just over-defining things in my controller.. Kinda as if you defined subscriptions more than you need to.
The answer I linked was what I looked at when I ran into it, so thought maybe one could work. Not sure if either help, but hope it leads you on the right direction!
Solution 2:[2]
To create multiple resources, you can use count or for_each meta-arguments. In this case refer the below code using for_each
locals {
s3_bucket_names = {
"bucket1" = "sample18764"
"bucket2" = "sample2038726455"
"bucket3" = "sample37233098"
}
}
resource "aws_s3_bucket" "s3_storage" {
for_each = local.s3_bucket_names
bucket = each.value
}
resource "aws_s3_bucket_public_access_block" "block_public_access" {
for_each = local.s3_bucket_names
bucket = aws_s3_bucket.s3_storage[each.key].id
block_public_acls = true
block_public_policy = true
restrict_public_buckets = true
ignore_public_acls = true
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jack L |
| Solution 2 | Ravichandran |
