[LRUG] Proffer and introducing constraints to Rails

Daniel Barlow dan at telent.net
Thu Apr 5 02:39:57 PDT 2012


On Thu, Apr 5, 2012 at 7:59 AM, Andrew Stewart <boss at airbladesoftware.com>wrote:

>
> On 4 Apr 2012, at 23:58, mudge wrote:
>
> > Perhaps if we could
> > simplify the view part to simply be:
> >
> > 1. Take some state;
> > 2. Return a string.
> >
> > Then views and helpers would be practically the same thing and we
> > could tackle some of these problems more easily.
>
> I think Mustache goes some way towards this:
>
>  https://github.com/defunkt/mustache
>
>
" We call it "logic-less" because there are no if statements, else clauses,
or for loops."

... except that to accommodate the people who actually do require these
things in their views, we've invented *our own* constructs for
conditionals, iteration over a list, and function call - it's just that
they use special-purpose syntax you'll have to learn separately

Or am I reading it wrong?  And what's so great about logic-free anyway?
Get business logic out of views, by all means, but there's nothing shameful
about putting the "if there are no results, display 'no results' instead of
an empty table" logic in the presentation layer - that's exactly where it
should go imo.  The model certainly shouldn't be responsible for knowing
how the UI should present an empty set

Sorry if that reads like flamebait.  Must drink more tea

-dan

-- 
dan at telent.net
http://ww.telent.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20120405/2eb36fcc/attachment.html>


More information about the Chat mailing list