Nesting and make_resourceful

Posted November 15, 2007

One of the many cool things about make_resourceful is that all the accessors and helper methods that make up the default actions and are used by the user are so concise. Most of them are one line. The rest are more, but just because they check properties of the controller to see how they should behave. If you implemented them for each controller individually, they’d also be one line.

Except for one: parent_objects.

def parent_objects
  return [] if parents.empty?
  return @parent_objects if @parent_objects

  first = parent_models[0].find(parent_params[0])
  @parent_objects = [first][1..-1].inject(first) do |object, arr|
    id, name = arr
    @parent_objects << object.send(name.pluralize).find(id)

make_resourceful 0.2.0

Posted November 4, 2007

After many months of development, make_resourceful version 0.2.0 is finally ready for release. We’ve now got a full set of specs (i.e. tests) and full RDoc documentation. The code is cleaner, bugs are fixed, the filesize is smaller1.

Oh, and there are new features. New, awesome features.


Before we go into the features, though, let’s talk about installing the thing.

More make_resourceful Delays - Sorry!

Posted October 20, 2007

So it’s October 20th. Definitely past mid-October. And still no make_resourceful 0.2.0.

Yeah. Sorry about that. I’ve been busy. I haven’t even made a blog post in a week, and I can almost always find time for that.

It’s gonna take more time, I’m sorry to say. Hopefully it’ll be ready sometime in November.

School Begins

Posted September 25, 2007

Tomorrow, September twenty-sixth, the first classes of the University of Washington’s Autumn Quarter will be taught. I will be attending four of those classes. I will be recieving homework from the instructors of those classes. Homework that I will be obligated to complete in a timely manner.

Yes, summer is gone. With it, unfortunately, goes most of my free time. As much as I love working on my various projects, I also love keeping up my GPA.

That’s not to say, of course, that I won’t be continuing to work on Haml and make_resourceful. I’ll just have less time to devote to them.

make_resourceful: Publish Extras

Posted September 11, 2007

I think we’ve established that publish is pretty darn cool. It’s pretty sweet to be able to generate a representation of any model in XML, YAML, or JSON, with any attributes or associations included or excluded. It’s especially sweet to be able to do so with no more effort than declaring the essential information.

But it wouldn’t be make_resourceful if that were it.

No, like everything else in m_r, publish is built upon several layers of support. Each of these layers has plenty of utility outside of its original purpose, and each can be accessed and customized by the programmer.

The layer immediately underlying publish is a method called serialize. This method is defined for ActiveRecord::Base models and for Arrays. It takes the same parameters as publish. But where publish publishes the data as an action, serialize just returns a string.

make_resourceful: The Basics of Publish

Posted September 10, 2007

make_resourceful has been coming along nicely, especially since I’ve left Microsoft and have had time to devote to it. I imagine we might be making an 0.2.0 release within the week. By the end of September at latest.

When it comes out, I’ll be sure to do a full writeup of it, like I did for 0.1.0. For now, though, I’d like to go over one of the most-anticipated and coolest features that you’ll see: publish.

Hampton actually talked about publish in his original m_r presentation. At the time, though, it wasn’t really in working condition. Because it required a fair amount of supporting code (and because I was off at Microsoft), it remained that way until recently.

Thanks to the help of James Golick, though, we’ve built up the necessary support and publish is up and running. And it’s very, very cool.