I’ve just finished writing up the documentation for my latest Rails plugin, Restflection. Probably none of it makes sense because it’s a quarter to 1 and I am bloody tired. But on the off chance it does make sense, here’s the blurb:
“Restflection is a Ruby on Rails plugin designed for use in applications which follow RESTful conventions. It allows you to extract information about resources without necessarily knowing what they are called.
For example, instead of writing
article_path, you could writerestflect(:member).path. Why would you do this? You may have shared code, for instance layouts or library files, which need to make use of a resource, but because they operate on any number of different resources, they cannot refer to them by name. The plugin could also be of use to other plugins.”
Posted on Saturday, June 02, 2007.
Have you checked out make_resourceful (full disclosure: I’m a developer for
make_resourceful, so this is a plug)? It has a much broader scope, but also comes with helpers that allow you do do similar things. For instance,restflect(:member).itin Restflection is equivalent to thecurrent_objectinmake_resourceful. I must admit I like the Restflection syntax a lot more – I wonder if we could work something like that in.Nathan Weizenbaum
Wednesday 06 June
10:30 AM
Hey Nathan,
Yep I’ve seen make_resourceful though I haven’t tried it. Really they do two different jobs and I wanted to do a plugin specifically for reflecting on resources. There are other plugins which do the same sort of thing including simply_presentable and resources_controller. But yeah, really I wanted to write something separate rather than use something tagged onto a plugin for a different purpose.
I’m not actually sure what I think about make_resourceful… I should (will) probably try it although one day I’m hoping I’ll have time to play with my own idea for a REST abstraction.
Jon Leighton
Wednesday 06 June
02:13 PM