Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Ruby has had these type of libraries for years. The original is probably Markaby, but today there are alternatives that are both faster (https://github.com/camping/mab/) and has more features (http://erector.rubyforge.org/).

It's an interesting concept, but I find that (1) it's hard to work on it together with designers and (2) for larger templates I don't find it that elegant.



The theme between these efforts seems to me: Instead of a separate language in a separate world, our views are normal objects/data (in all their glory and power) that happen to know how to print themselves as html.


I'm certainly no cultist of MVC, but I would tend to agree with them that tightly coupling presentation details to the basic model is usually unwise.


You're not supposed to put these into your models. You should create a different class/method that accepts models and returns HTML:

    class TweetWidget
      def initialize(tweet)
        @tweet = tweet
      end
      
      def content; … end
    end




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: