February 19th, 2008 by ymendel 8 comments »
Man, that’s not a lot of scrollbar, good
Object Daddy has had a little bit of work done recently:
- Trying to get it to work on Rails 2 uncovered some problems that were apparently there for a while, meaning they didn’t work well even with Rails 1.2.6 (or maybe 1.2.5). We were trying to figure out what the hell it was developed on so that the test suite ran. Maybe 1.2.3. Anyway, it’s generating stuff well now.
- New ways of creating generators!
- Klass.generator_for :attr do Time.now end # |prev| block argument not required
- Klass.generator_for :attr, value # if you want the same literal value every time
- Klass.generator_for :attr => value
- It now follows inheritance, which is especially nice for STI. To take the examples from the specs, assume a Widget class and a SubWidget class that inherits from Widget.
Widget.generator_for :foo, 'blah' SubWidget.generate.foo # => 'blah' SubWidget.generator_for :foo, 'blip' SubWidget.generate.foo # => 'blip'
That’s all for now.