Can anyone help point me in the right direction on doing the following? Say I have a Rails app that deals with photos at photo.website.com, and I also have a legacy site at www.website.com. 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: <img src="http:// photo.website.com/randompic.jpg" /> 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? Thanks in advance. Mark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Mark, I would be inclined to create a controller and have an action on it that serves up a random image. This would make your static URL something like http://photo.website.com/random/pic 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 On Tue, 30 Dec 2008 16:17:57 +0900, mksys <mk-dXxdSIuY+4FDPfheJLI6IQ@public.gmane.org> wrote:> > Can anyone help point me in the right direction on doing the > following? > > Say I have a Rails app that deals with photos at photo.website.com, > and I also have a legacy site at www.website.com. > > 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: <img src="http:// > photo.website.com/randompic.jpg" /> > 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? > > Thanks in advance. > Mark > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---