際際滷

際際滷Share a Scribd company logo
Patrick Crowley
Rails for Legacy Apps
(How to use Rails
with existing apps)
Rails For Legacy Apps
Rails For Legacy Apps
   New ideas
New ideas

 No users
New ideas

 No users
 Zero code investment
New ideas

 No users
 Zero code investment

 Best case scenario
But, in the real world...
Rails For Legacy Apps
Rails For Legacy Apps
   Legacy content
Legacy content

 Existing userbase
Legacy content

 Existing userbase
 Front end (HTML + CSS)
Legacy content

 Existing userbase
 Front end (HTML + CSS)

 Database Schema
Q: How can I use Rails
 with a legacy app?
Rails For Legacy Apps
 Dont! (Leave site as is)
 Dont! (Leave site as is)
 Reboot site with Rails
 Dont! (Leave site as is)
 Reboot site with Rails
 Or, maybe...
Use Rails as a control
panel to run your site
Case study:
Cinema Treasures
Rails For Legacy Apps
Rails For Legacy Apps
Front-end

                Smarty
Blogs
              Theater DB

        pMachine

    PHP/MySQL
How did we edit
  theaters?
phpMyAdmin
   (sadly)
Rails For Legacy Apps
 Intended for developers
 Intended for developers
 Easy to harm database
 Intended for developers
 Easy to harm database
 Doesnt scale
Why not roll your own?
Rails For Legacy Apps
   Not highest priority
Not highest priority

 Busy with other things
Not highest priority

 Busy with other things
 I never want to write
 PHP again.
Lets do it in Rails!
Basic concept
Current site



 Database
Current site        Rails



         Database
Demo
Issues I ran into
Rails For Legacy Apps
 Non-plural table names
 Non-plural table names
 Had to remove primary
 ids on join tables
 Non-plural table names
 Had to remove primary
 ids on join tables

 Needed a way to delete
 cached templates on
 db update
How long did this take?
1 week /
2 - 3 hours per day
The End
Rails For Legacy Apps
New Theaters
6,000


4,500


3,000


1,500


   0
        2000   2001   2002   2003   2004   2005
New Comments
50,000


37,500


25,000


12,500


    0
         2000    2001   2002   2003   2004   2005

More Related Content

Rails For Legacy Apps