DEV Community

Discussion on: Rails N+1 query and Draper decorators

Collapse
 
ben profile image
Ben Halpern

Nice post.

If you’re curious, there are now built in alternatives to Draper, which we recently implemented... just in case you’re curious about moving off the external dependency.

Not that Draper hasn’t been a fabulous gem.

Switch decorators from Draper to Rails builtin decorations #6040

rhymes avatar
rhymes commented on Feb 12, 2020

What type of PR is this? (check all applicable)

  • [x] Refactor
  • [ ] Feature
  • [ ] Bug Fix
  • [x] Optimization
  • [ ] Documentation Update

Description

This PR does the following things:

  • uses delegate_missing_to that was added in Rails 5.1 as a simpler decoration mechanism
  • fixes some bugs in the existing decorators
  • adds specs for all decorators methods that were missing them
  • says bye bye to Draper 🗡 as we use none of its advanced features and draper has too much magic 👀

Added tests?

  • [x] yes
  • [ ] no, because they aren't needed
  • [ ] no, because I need help

Added to documentation?

  • [ ] docs.dev.to
  • [ ] readme
  • [x] no documentation needed
Collapse
 
agustincchato profile image
Agustin Martinez

oh, I haven't heard about that before. I'll look at that. Thank you!