What I would like to do is from a static html page on www.website.com
have a random photo displayed from the photo app.
So, if I put something like this in my static page:
would it be possible when a user hits the static page to have it
routed to an action that would pull a random photo and return it to
the static page in the form of an image?
well, i don’t know much about your rails app. so i can’t tell you how
exactly you should do it. but generally spoken: yes, that should be
possible. actually in exactly the way you proposed.
Create a controller called random, and an action called pic (you can
call
these anything, or even use the default index action). In your action,
just pick a random image and serve it back to the browser.
We do something similar, without the randomness to serve images to
external applications.
Cheers
Simon
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.