[uf-rest] New microformat/REST Ruby Parser: mofo
James Stewart
jystewart at gmail.com
Thu Mar 15 14:37:41 PST 2007
On Mar 15, 2007, at 8:20 PM, Rick Olson wrote:
>> WHat I wanted to be able to do was post HTML (marked up with
>> microformats)
>> to my endpoint just as I would post XML, and to have mofo then
>> parse that
>> HTML and pull out the relevant content.
>
> The problem with this is that unless you code your rails models to
> match specific microformats, the chances of the two data formats
> lining up are slim. You'll need to write a custom param parser that
> wires attributes from whatever microformat you're receiving with your
> model's attributes.
One thing I've been considering for that is overriding the new and/or
create methods on my models (or adding a new method) that will accept
a mofo object as input and map it to field names. That could work as
a plugin. So my process would be:
* param_parser detects microformats and sets up params containing
the microformat objects
* overridden AR method receives microformat objects and translates
them into models
It's not as elegant as I'd like, but it's the best I've been able to
come up with so far.
James.
--
James Stewart
Play: http://james.anthropiccollective.org
Work: http://jystewart.net/process/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://microformats.org/discuss/mail/microformats-rest/attachments/20070315/1bc15d1e/attachment.html
More information about the microformats-rest
mailing list