-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display Case vs. Draper #6
Comments
I don't have any experience with Draper, so I can't offer anything useful off the top of my head. @avdi, you'd be the best to answer this, I'd guess. Maybe @steveklabnik has some words since I know he's put some work into Draper and also read Objects On Rails. If you guys have a moment, would you care to comment? (Does github even let me rope someone not involved in the project into the conversation like that?) If not, I'll do a little research on Draper next week and post what would be a superficial opinion. I guess this could go into the documentation of display_case to help people decide when it's better to use neither, one or the other, or both in conjunction. |
(Yes, it does let you rope them in) The biggest difference in terms of implementation is this: https://github.com/objects-on-rails/display-case/blob/master/lib/display_case/exhibits_helper.rb vs this: https://github.com/jcasimir/draper/blob/master/lib/draper/view_context.rb Usage wise, Draper pretends to be Yet Another Model, and display_case uses the helper in the controller to handle this kind of thing. That's from my initial reading anyway. |
TBH I have no idea. I wanted to get the patterns I'd been using on projects down on "paper" before I moved on to see how Draper differed, and I still haven't found the time to do a project with Draper. I gave Jeff some feedback on it in early days but I don't know how much of that he incorporated. Sorry I don't have a better answer. I'd be interested to see a comparison. |
Aside: I'd love to poke around in Draper's Rails integration bits and possibly steal stuff. I put zero time into hooking into the Rails stack and left most everything explicit. I think Draper's probably a lot more advanced in that department. |
(oh, and there's gonna be a bunch of re-writing of things for Draper 1.0, so some stuff may change in the future too.) |
@avdi ping me if I can help. I re-wrote the generators, for example, to be super awesome. Honestly, I'm pretty sure the gems are basically identical. |
Thanks for the response guys!
When I first heard about Draper, I kind of shrugged it off and didn't see the need for it (I was also only 1/2 paying attention). When I read through Objects on Rails and saw the Exhibit stuff, I went off to implement it myself in a project and it looked more like what you described as Draper in that quote. Just thought it was a funny story I thought I'd share -- nothing more. |
One of the bigger differences I think, is the fact that you can easily layer multiple exhibits on an object, where draper seems to enforce a 1-1 relationship between decorators and models |
That's not actually true, though it is kinda implied. I have an open ticket to make this use case a bit more explicit. |
Thanks for the discussion guys. It helped shed some light on the tradeoffs. |
One Draper feature that looks very useful is automatic association decoration: jcasimir/draper@1580baa |
I like how DisplayCase relies on passing view context explicitly. Draper can do that too, but also creates and maintains own context https://github.com/jcasimir/draper/blob/master/lib/draper/view_context.rb - much too clever for my taste. |
What are the differences between this and Draper?
The text was updated successfully, but these errors were encountered: