I’m trying to wrap my mind around the idea of having a simple rails
application that acts as a platform and having other rails applications
running on the platform. Of course this sort of idea is all the rage
these days with every social networking site but I just want to be able
to do that on a smaller (and simple if possible) scale.
Say I have on app that manages users and maybe every user has a calendar
and they can have contact lists of other users. And say the app is
RESTful so we have a clean api:
/users/1;contacts
/users/2;home
/users/3/calendar/2008/03 etc
How do I go about turning this little app into a platform that other
applications can use? Say I want a simple polling application so a user
can poll his/her contacts on how they feel about something. How do I
design this polling app to run on the above (platform) app without
coupling too tightly? Will this polling app be able to live as a
stand-alone rails app?
I’m trying to learn about web application platforms so I’m still quite a
bit in the dark here. Any ideas will be appreciated. Thanks.
Just to add onto what I said above. I would also like to have clean urls
for my apps that run on the platform. Say, for the polling app, to have
something like
/users/4/poll/2;results
I think you are answering your own question although you don’t realize
it as such. If you care to view it that way, REST is giving you a
simple API that you can use from anywhere that has the ability to send
HTTP requests your way. It just happens to be the case that the
default deployment is HTML pages that are wired to those RESTful URLs,
but it could just as easily be a Facebook app… I mean another
application that uses your site as a ‘platform’.
I think you are answering your own question although you don’t realize
it as such. If you care to view it that way, REST is giving you a
simple API that you can use from anywhere that has the ability to send
HTTP requests your way. It just happens to be the case that the
default deployment is HTML pages that are wired to those RESTful URLs,
but it could just as easily be a Facebook app… I mean another
application that uses your site as a ‘platform’.
Thanks a lot Andy. My thinking was leading me that way but I just was
not clear on how to wrap my mind around it. Thanks for your very simple
explanation, it’s definitely made my a understanding clearer.
Thanks Mick. Just found a useful rails cast. I was still working with
rails v1.2.6, finishing up an app before I upgraded it to v2.0.2. Seems
like v2.0.2 clearly answers my questions.
I agree that ActiveResoure will do the job, but only if you’re
controlling both applications. That is, your ‘platform’ app exposes a
RESTful API that ActiveResource consumes fairly simply, so you can
create another app that uses the ‘platform’ with no trouble. I’m
doing that with one application that I’m working on because it will
allow me to scale major subsystems up and down as necessary. I was
under the impression, though, that you wanted other people to be able
to use your ‘platform’ and, if that’s the case, ARes only helps them
if they’re doing Rails, too…
I agree that ActiveResoure will do the job, but only if you’re
controlling both applications. That is, your ‘platform’ app exposes a
RESTful API that ActiveResource consumes fairly simply, so you can
create another app that uses the ‘platform’ with no trouble. I’m
doing that with one application that I’m working on because it will
allow me to scale major subsystems up and down as necessary. I was
under the impression, though, that you wanted other people to be able
to use your ‘platform’ and, if that’s the case, ARes only helps them
if they’re doing Rails, too…