SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Zealot RyaninZion's Avatar
    Join Date
    Jul 2003
    Location
    Jerusalem
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Combining Rails apps

    Does anyone know how to combine two self-contained Rails apps?

    I rebuilt one of our sites in Rails, and now want to add a forum to it. Decided to go with RForum in order to keep everything Rails. But RForum is its own Rails app, and I am not sure how to make it part of the rest of the site.

    Thanks.

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    What are you trying to integrate? Why can't you just put the forum in as a subdomain or subdirectory of the site?

  3. #3
    SitePoint Zealot RyaninZion's Avatar
    Join Date
    Jul 2003
    Location
    Jerusalem
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by vgarcia
    What are you trying to integrate? Why can't you just put the forum in as a subdomain or subdirectory of the site?
    With the folder structure of a Rails app, what subdirectory would place a whole other Rails app into? And how would I call its controllers and actions? And how would I cause it to use the mother app's layout template?

    Also, with RForum in particular, it uses a site.rb file to define some global config settings. I am afraid those will somehow effect other areas of the main site.

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Location
    Murcia, Spain
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe you could do it but by analyzing the content of each file, controller, model, helper and view very carefully to make sure they don't coincide. Then, if there are files that have the same name (like the site.rb you mention in 2 apps for example) then would it be possible to merge them into one file as long as the methods inside don't clash. Just some thoughts

  5. #5
    SitePoint Zealot RyaninZion's Avatar
    Join Date
    Jul 2003
    Location
    Jerusalem
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Mmmm, that's what I was afraid of - having to go through all the methods and views and tweaking everything to integrate.

    Shame there is not an easier way to plug premade Rails apps - such as a discussion board - into an already existing app.

    I guess for now I can just go with a PHP board and put it in the public folder.

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Location
    Murcia, Spain
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't know what server you're running but they just released lighttpd 1.4.8 and you can now stick several rails apps under one domain. I'm working on setting that very thing up right now for a site.

    So you can do site.com/blog, site.com/forum etc, etc..

    What I'm not entirely sure of is whether or not that can be done in sub folders of an existing app. I assume so and that I just need to fugre out exactly how.

  7. #7
    SitePoint Zealot RyaninZion's Avatar
    Join Date
    Jul 2003
    Location
    Jerusalem
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Unfortunately, we are running off a Windows server, so lighttpd is not an option. I am using Apache.

  8. #8
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Location
    Murcia, Spain
    Posts
    66
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm sure I've read that it's already possible on Apache. Have a look round textdrive and the rails sites.

  9. #9
    SitePoint Guru silver trophy Luke Redpath's Avatar
    Join Date
    Mar 2003
    Location
    London
    Posts
    794
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RyaninZion
    Unfortunately, we are running off a Windows server, so lighttpd is not an option. I am using Apache.
    Thats a shame. lighttpd has just released a new version that will do exactly what you want:

    http://blog.lighttpd.net/articles/20...ple-rails-apps

    Perhaps its worth getting hold of a Unix box, a VPS or something. IMO, Windows is really not an ideal platform for Rails.

  10. #10
    SitePoint Zealot RyaninZion's Avatar
    Join Date
    Jul 2003
    Location
    Jerusalem
    Posts
    158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I guess the easiest thing with Apache will be to put the forums app under a subdomain. Problem is, will I be able to still utilize the global template from the mother app in the forum?

    I agree installing Apache on our server would be best, but for now we are stuck with Windows. Those I work with are a little apprehensive about switching to Linux, fearing they would no longer know how to manage the server.

  11. #11
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,236
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by RyaninZion
    I guess the easiest thing with Apache will be to put the forums app under a subdomain. Problem is, will I be able to still utilize the global template from the mother app in the forum?
    As long as the forum content doesn't screw things up in the layout you should just be able to copy your layout from app/views/layouts/* in your main app, move it to the forum app, and add "layout :whatever" to your forum controllers. The only thing you'd probably have to change in the actual layout are any url_for or link_to calls that rely on your main app.

  12. #12
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is probably one of the main downer on Rails imo ...

    Like people are suggesting you want to install under different subdomains. This will add some complications for a portal-style site where user logins persist across subdomains. The main thing here is to make sure that your cookies / sesssions are set to work over the subdomains (i.e. only set them on a 2nd level domain level). You may need to hack the user models and controllers for the each subdomain too inorder to merge things together. Though it sounds a pain, it's probably not too bad to do


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •