I ran into a rather annoying problem when working with the Rails 4 mailing list preview and factory girl. Here is an example of my code:
class TransactionMailerPreview < ActionMailer::Preview def purchase_receipt account = FactoryGirl.build_stubbed(:account) user = account.owner transaction = FactoryGirl.build_stubbed(:transaction, account: account, user: user) TransactionMailer.purchase_receipt(transaction) end end
It really can be viewing any email program. Suppose I am mistaken (something happens every time), and there is an error. I fix the error and refresh the page. Every time this happens, I get:
"ArgumentError in Rails :: MailersController # preview A copy of the User has been deleted from the module tree, but is still active!"
Then my only way out is to restart my server.
Am I missing something? Any clue as to what causes this and how can this be avoided? Because of this, I restarted my server 100 times in the last week.
EDIT: Can this happen anytime when I edit my code and update the preview?
ruby-on-rails-4 factory-bot actionmailer
gregblass
source share