GithubHelp home page GithubHelp logo

Comments (5)

jcasimir avatar jcasimir commented on July 20, 2024

Can you try it with the edge code in the repo? I'm thinking that the just-merged Decorated Collection Proxy will help with this issue.

from draper.

jcasimir avatar jcasimir commented on July 20, 2024

Yes! I just did some tests that indicate this is solved in 0.9.2. I created an ActiveRecord::Relation, then decorated it, then was able to call further AREL methods modifying the collection.

Please comment/reopen if you're still running into issues.

from draper.

jcarlson avatar jcarlson commented on July 20, 2024

Well this certainly helps.

What this does not do, however, is decorate items in the collection when chaining methods on the collection:

>> posts = PostDecorator.decorate Post.scoped
  Post Load (0.1ms)  SELECT "posts".* FROM "posts" 
=> #<Draper::DecoratedEnumerableProxy:0x1057a44e0 @klass=PostDecorator, @context={}, @wrapped_collection=[#<Post id: 1, title: "My first post", content: "# This is an H1\r\n\r\n## This is an H2\r\n\r\n### This is ...", publish_at: "2011-10-22 18:07:00", slug: "", created_at: "2011-10-18 23:05:54", updated_at: "2011-10-22 19:00:08", public: true>]>
>> posts.where(:public => true).first
  Post Load (0.2ms)  SELECT "posts".* FROM "posts" WHERE "posts"."public" = 't' LIMIT 1
=> #<Post id: 1, title: "My first post", content: "# This is an H1\r\n\r\n## This is an H2\r\n\r\n### This is ...", publish_at: "2011-10-22 18:07:00", slug: "", created_at: "2011-10-18 23:05:54", updated_at: "2011-10-22 19:00:08", public: true>

Notice that the Post returned from the call to #first is not decorated!

However, I'm satisfied with what I've got working right now, and I think it's fair to call this little nuance a totally separate issue...

Thanks!

from draper.

jcasimir avatar jcasimir commented on July 20, 2024

Hmmm, now that is interesting! I don't, without more research, know much about how the ARel scopes are added together. If you look into it at all, please report back.

from draper.

amiel avatar amiel commented on July 20, 2024

FYI: I'm working on integrating draper support in ActiveAdmin here: activeadmin/activeadmin#1117

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.