[LRUG] file-cached rails routes

Lee Henson lee.m.henson at gmail.com
Wed Jan 25 06:52:10 PST 2012


Hi list

I've got a ruby daemon chugging along doing all kinds of interesting
offline-processingy things for me, but one thing I need it to do is be able
to generate a url to a page in one of my rails websites:

url_to_widget_page = "http://doodah.com/some/path/here"

...but that explicit path might go mouldy as the system evolves. It would
be nice to be able to do:

url_to_widget_page = "http://doodah.com#{widget_path}"

much in the same way that you can do in rails. I'm already using the
js-routes gem to generate a "file cache" of the routes in my web app, so I
can do:

Router.widget_path()    // returns '/some/path/here'

from js, and the file is regenerated on every request in dev mode. I'd like
the same capability from non-rails ruby code.

My google-fu seems weak in this area - has anyone seen a gem like this or
have any alternative ideas on how this goal might be achieved? I don't
think porting the js-routes gem would be too hard, but I'd rather not
reinvent the wheel.

Cheers
Lee
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lrug.org/pipermail/chat-lrug.org/attachments/20120125/163289f8/attachment-0003.html>


More information about the Chat mailing list