GithubHelp home page GithubHelp logo

Comments (8)

nfm avatar nfm commented on August 22, 2024

Agreed, this would be a great feature.

from draper.

michaelfairley avatar michaelfairley commented on August 22, 2024

I've taken a first pass attempt at solving this. Check out #85

from draper.

tarasevich avatar tarasevich commented on August 22, 2024

Still this method needs to be fixed to support lazy loading from DB of associations

  def self.decorate(input, context = {})
    input.respond_to?(:each) ? Draper::DecoratedEnumerableProxy.new(input, self, context) : new(input, context)
  end

from draper.

michaelfairley avatar michaelfairley commented on August 22, 2024

Fixed.

from draper.

nfm avatar nfm commented on August 22, 2024

What do you think about taking an array of association symbols to decorate, and iterating over them?

def self.decorates_association(*association_symbols)

Then you'd end up with:

decorates_associations :posts, :images, :links

Rather than:

decorates_associations :posts
decorates_associations :images
decorates_associations :links

I guess it depends on whether there's the possibility of accepting options for decorating associations or not.

from draper.

michaelfairley avatar michaelfairley commented on August 22, 2024

Done. There's now decorates_association which takes one symbol, and decorates_associations which takes multiple.

from draper.

tarasevich avatar tarasevich commented on August 22, 2024

awesome work

from draper.

steveklabnik avatar steveklabnik commented on August 22, 2024

Since this is basically a dup of pull #85, and it's got code, I'm closing it here.

from draper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.