0

I've completely removed rvm and installed 0.5.10 of mailcatcher. When I run mailcatcher I get the following error:

.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/activesupport-3.2.22.5/lib/active_support/core_ext/object/duplicable.rb:111:in `<class:BigDecimal>': undefined method `new' for BigDecimal:Class (NoMethodError)
    BigDecimal.new('4.56').dup

What could be causing the error?

mkelley33
  • 5,323
  • 10
  • 47
  • 71
  • Provide a full script that you have a trouble with please. Gem mailcatcher works on Ruby 3.2 - this version in CI matrix of the repository. So, the reason of fail probably somewhere in your environment. – Vasily Kolesnikov Jul 07 '23 at 23:54
  • 1
    Why does it have to be MailCatcher 0.5.10? That's pretty old as is ActiveSupport 3.2 – mu is too short Jul 08 '23 at 01:46
  • @VasilyKolesnikov the error only happens when I run mailcatcher. Installation succeeds, but I don't know what script I could provide you to better help with answer. – mkelley33 Jul 08 '23 at 02:12
  • @muistooshort It doesn't have to be mailcatcher. I'd be interested in any solution that involved intercepting e-mail and redisplaying the HTML email in a browser. Do you have any recommendations? – mkelley33 Jul 08 '23 at 02:14
  • I did some more digging and found https://github.com/mailhog/MailHog?ref=stackshare which satisfies my needs. – mkelley33 Jul 08 '23 at 02:37
  • I use MailCatcher with Ruby 3.2, just a more recent version of it. – mu is too short Jul 08 '23 at 08:55

2 Answers2

4

Mailcatcher version 0.5.10 was released in September 2012, more than 10 years ago. And this ancient version requires activesupport ~> 3.0 which is part of Ruby on Rails and therefore adding it to your Gemfile and running Bundler, downgraded your application's Rails version to the latest 3.2 version.

To fix this problem, I suggest adding Mailcatcher to your Gemfile without specifying any version, like this

gem 'mailcatcher'

and running bundle install again.

That should install the latest version of the Mailcatcher gem (0.8.2 at the time of writing this answer) which should run fine with up-to-date versions of Ruby on Rails.

spickermann
  • 100,941
  • 9
  • 101
  • 131
  • Alas, I am not running Ruby on Rails. It's for a nodejs project, but thank you for the answer. I chose to go with MailHog instead, because it just worked out of the box. That way I don't have to put a Gemfile in my project or use Ruby. – mkelley33 Jul 08 '23 at 20:00
0

If you don't want it in your gemfile then what worked for me after upgrading to Ruby 3 and rails 7 was to use the latest beta version with gem install mailcatcher --pre.