So, Ruby is OO all the way, but in Rails we can?t render an object?
Having retyped way too many calls to ActionViews render method with
various options, I finally figured, why not make it possible to actually
render customized objects, which could encapsulate the often messy code,
that I often ended up writing partly in the controller and partly in the
view - using instance variables, and typing ?if? way too often in the
What I ended up with were ?Ren(d)jects?, objects capable of being
I have already made a functional plugin using only 66 lines of actual
code (well, actually only 28, but I thought a few basic helpers would be
nice ;-), and I would really like some feedback?
Source and documentation is avalible at
documentation includes a brief introduction to the concept of Rendjets -
and of cause a few small examples, which show how to use them. To some,
the examples will perhaps at first sight seem at bit too complex, but
think code reuse and easier debugging!
Having tried using Ren(d)jects when generating sidebars based on
multiple independent blocks, I already find encapsulating partial
rendering pretty neat ? from now on such blocks have to be very complex
before I?ll end up using components?
Heino H. Gehlsen