Giter VIP home page Giter VIP logo

decorates_before_rendering's People

Contributors

johnbintz avatar robhanlon22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

decorates_before_rendering's Issues

Plural objects, decorates method

It seems like supporting plural objects (for instance in Controller#index) is a bit more difficult that necessary.

Is there a reason your code isn't using Model#decorate? I just started using Draper this evening, so I'm still stumbling my way around, but it appears that I can call decorate on my model objects (in 0.18.0 it's in Draper::ModelSupport, and in the beta releases it looks to be in Draper::ModelSupport. I can even do Model.where(condition).decorate, and it creates a DecoratedEnumerableProxy for the collection.

It seems like you should be able to dramatically simplify the code so all it has to do is see if the object supports decorate and if so then call it!

uninitialized constant DecoratesBeforeRendering

I'm trying to install DecoratesBeforeRendering gem but get an error uninitialized constant ApplicationController::DecoratesBeforeRendering while include (DecoratesBeforeRendering or ::DecoratesBeforeRendering) in a controller. Gem is present in my Gemfile.lock. Why an error has occurred?

What if you are not using instance vars to pass state to views?

IMO, using instance vars is a "bad hack", back from the dirty hacking days of 2005-2008. The good style is to instead expose public methods to the view that return the object(s) in question.

See fx https://github.com/hudge/proffer https://github.com/voxdolo/decent_exposure and several other similar gems trying to patch this anti-pattern...

See also: http://elia.schito.me/tagged/instance-variables

Would be nice with an extension of this gem to allow for a more modern approach :)
Cheers!

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.