awesome-print / awesome_print

Pretty print your Ruby objects with style -- in full color and with proper indentation
http://github.com/michaeldv/awesome_print
MIT License
4.07k stars 454 forks source link

Ignore AR accessors raising errors #359

Closed phstc closed 3 years ago

phstc commented 5 years ago

Solidus deprecated some AR attributes by raising errors, but without removing the columns in the database:

https://github.com/solidusio/solidus/blob/v1.4.2/core/app/models/spree/promotion.rb#L57-L63

With that, if we try to load a promotion Spree::Promotion.first with awesome-print we get:

Spree::Promotion.first
  Spree::Promotion Load (0.6ms)  SELECT "spree_promotions".* FROM "spree_promotions"
(pry) output error: #<RuntimeError: Attempted to call code on a Spree::Promotion. Promotions are now tied to multiple code records>

Making Spree::Promotion inaccessible via console when using awesome_print.

This pull request ignores errors when errors when loading attributes.