Host multiple application under single domain - ruby-on-rails

Currently I develop new app for my customer and need to integrate it with the old one.
My current app based on Ruby 1.9.3 and latest Rails version. Old app written on Ruby 1.8.7 and something like rails 3.0.11.
So my goal is to host it under one domain, so if localhost/old_controller will bring customer to some old controller, and localhost/new_controller will be handled by my application. Is it possible and how to do that? Or if it's not possible, then handle new app as a sub domain for the old one, like localhost for old one and new.localhost for my app.

Take a look at Rails Engines. Basically they are Rails Applications which can be hooked to another application.
As for the authlogic matter: If both of your apps share the same database then there shouldn't be a problem regarding the logins - provided you use gems in both apps that share the same schema they're built on.

Related

Is it possible to buld a CLI app using Ruby on Rails?

I'm new to Ruby and I'm looking to write a CLI app. My app is not suited for a web app. I'm running Ruby 2.2.2 on OSX and Ubuntu.
Can I use Rails to build an app that is strictly interacting via the CLI (not via HTTP)?
Yes, you can definitely use a Rails app. That's the short answer.
As Controllers and Views are likely unneeded in a CLI application, a large chunk of the Rails framework will be obviated entirely. But Rails models, ActiveRecord, Arel and the database management aspects are really powerful. How nice it would be to just leverage those.
SHOULD you? Outside the scope of your question and highly dependent on your requirements & personal preference, which I'm not privy to, of course.

Multitenant Rails app - Strategies for pulling customer data

I am developing a multitenant Rails app using Postgresql schemas. All is going great, but my situation is a little different from the conventional multitenant apps out there; namely my app will require that I pull customer data for each tenant from their database to mine.
Here is where it gets tricky. I wrote a jRuby gem that connects to each customer's database and pulls data to my server, and then it processes that data and loads it into my Rails app (each customer set of data will end up in the appropriate tenant schema). Therefore this gem is the only place that it aware of all my tenants and their configuration (database info, which tables to pull, and so on).
My question is: What do you think of this design choice? Some of the problems I am already seeing is that this forced the app to be in two Ruby states, i.e. it normally functions in Ruby, but when I need to do a pull, I have to switch to jRuby. Furthermore, it is hard to inspect into tenant configuration without resort to this gem.
Any comments or feedback on this? Is there another path I could have taken with this?

How to transfer skills from Rails tutorial to real project with real URL?

I have been teaching myself Rails for some time with various tutorials and have been asked by a relative to create a basic personal website (static pages only) for them. The relative already owns the domain at which they want the website to be created.
My question has to do with deploying an app that I create to a real domain. In my tutorials I've learned about developing the app on my local machine, using Git for version control, and deploying to Heroku (eg http://name.herokuapp.com). If someone wants me to develop the site that will live at www.website.com, how do I get my app there? Is there a good tutorial for this that I can follow?
I'm no rails expert, but a good place to start might be looking at the support docs for whatever host your client is using. Dreamhost has a wiki covering RoR, and other hosts like Hostgator do as well.

Ruby on rails making an app for smartphone

I want to build an app that use in the backend Ruby on Rails. However my problem comes in the lack of information i found on it. My goals is not just to create a website but an application that interacts with it, like my android facebook app when pressing menu I get button like logout and so on.
I am wondering if their exists tutorial on how to build an application but using rails or should i scrap my entire website and do it in php. I am looking for guide and tutorial. Thanks in advance
You can build an app on any platform and make it interact with your Rails-based server using HTTP requests (like AJAX).
You can send information back and forth using JSON or XML; you would probably need to make a new set of actions for the app to use.
There is no reason to use PHP. ever.
A little unclear from your original question, but if you are looking to create a mobile app using Ruby (and a structure similar to Ruby on Rails) then you may be interested in Rhomobile. It is a cross-platform mobile application framework that uses Ruby for its backend code, and follows a structure similar to (older) Ruby on Rails versions.
From what I understand of your problem, you want to use the robustness of Ruby to develop a native app (not just another app that mirrors a website).
The best thing I know of for this is RubyMotion. The bummer is the cost ($200). But then you would get to accomplish your task.

Rails 2.1 and Rails 2.3 sharing the same database

We have an admin application used to manage member data and it was built in 2.1, has been running for about a year. Now that all inputs and data massage is done, our client wants to start building member site, members will have access to data the administrators have been inputting.
Here's the question, should we start a new Rails app hooked to the same admin database or should we create a new Rails app in different db with master-slave settings? The good thing about creating a new Rails app is obviously taking advantage of the new version, which we like. Or ..maybe just build the member site in the same admin app?
THanks,
Why don't you want to build the member site in the same admin app? Too much legacy?
You can use the same database but the problem is you will have to enforce any conditions you have in your models directly in your database (mandatory fields, model relationship and so on).
And I can see a lot of duplication code happening between the two apps. At least for the models. Which is really wrong :(
I don't recommend making two separate applications but It is hard to answer without looking at your app and without knowing more details.
Or build a new app using a copy of the existing database?
There's no reason the two applications cannot share the same database.
However, there's probably a number of reasons why they shouldn't. But, the only way you're going to figure those out are by going through the changelog of ActiveRecord's database adaptors.

Resources