On the Rails console, assigning an object to a variable can lead to this strange error (without stacktrace):
irb > recipient = Recipient.find(123) Traceback (most recent call last): TypeError (nil can't be coerced into Integer) irb > recipient #<Recipient ...
The error is only in the output – the assignment is working. It only occurs when using the
--nomultiline option, and thus . Also, it depends on the value of the assignment – not every
Recipient (in this example) will trigger it.
Its cause is in
gem install reline, or in projects with Bundler:
gem 'reline', '>= 0.2.0' # Fixes TypeError in Rails console