Matheus Leite

Joined

460 Experience
4 Lessons Completed
0 Questions Solved

Activity

Posted in Heroku and Schedule Jobs

Hello!
I'm implementing a new feature in my app that e-mailing all users every first day of the month. My app is running in Heroku.

My question is: what is the best way to achieve this feature?

We are already using redis with resque to queue job

I don't know how simple_discussion works, but the error by itself tell us what is going on.

Probably, you have a "belongs_to :user", so you cant delete a user because this relation.

I can see two way to handle it:

First -> when deleting a user, delete all forum_threads related to this user. At Users model, add "has_many :forum_threads, dependent: :destroy".

Second -> when deleting a user, nullify user_id at forum_threads table. At Users model, add "has_many :forum_threads, dependent: :nullify"

https://guides.rubyonrails.org/association_basics.html#options-for-has-many-class-name