# Rails as a frontend for an existing application, best practi

**URL:** <https://www.ruby-forum.com/t/rails-as-a-frontend-for-an-existing-application-best-practi/109794>\
**Category:** Rails\
**Created:** [July 19, 2007, 3:41am UTC](https://www.ruby-forum.com/t/rails-as-a-frontend-for-an-existing-application-best-practi/109794 "2007-07-19T03:41:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [July 19, 2007, 3:41am UTC](https://www.ruby-forum.com/t/rails-as-a-frontend-for-an-existing-application-best-practi/109794/1 "2007-07-19T03:41:09Z")

</div>

Hi everybody,

I am starting to write a new, web-based frontend for an existing  
Delphi / MSSQL application. I am now looking at Rails as I want to use  
the framework’s convenient ways to build a smooth user experience.  
Now, I have a few basic concerns, which I couldn’t really answer  
myself by using Google.

We will transfer a lot of data (products, customers, invoices, etc.)  
from the local MSSQL database to the webserver’s MySQL database.  
Rowcount is in the 100,000. This data will be used for displaying or  
searching purposes only, that means there will absolutely nothing but  
reads from these tables. They all come with their primary and foreign  
keys (everything is integer).

Now, I would like to use these existing primary keys for my Rails  
application - instead of having another “id” primary key generated by  
Rails. Will that give me problems later on? Is it an absolute  
necessity for Rails to give all tables it’s own primary key? I don’t  
understand ActiveRecord well enough to see the consequences.

If it is indeed possible, then it should be okay to import data  
outside of Rails, namely by mysqlimport from the command line. I did  
some tests with ar-extensions and fastercsv, but they are both not  
workable solutions because of server load and speed issues. Will Rails  
ever notice if I fill it’s tables from the “outside” ?

For some of these tables, I will even use data with gaps (skipped rows  
when exporting), so there are gaps in the primary keys. Is that a  
problem?

Last question - if I use helpers such as act\_as\_taggable on these  
tables, is it possible to keep the tags in a separate table? Remember,  
I can only use the imported data for reading.

Maybe now you’re thinking I shouldn’t use Rails for this project in  
the first place - if so, I also would like to hear what you have to  
say.

Thanks a lot guys, I appreciate any help, you don’t have to answer all  
the questions of course 😉

Ben

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [July 19, 2007, 4:25am UTC](https://www.ruby-forum.com/t/rails-as-a-frontend-for-an-existing-application-best-practi/109794/2 "2007-07-19T04:25:15Z")

</div>

Answers:

“I would like to use these existing primary keys for my Rails  
application”?  
YES. You can override the built-in primary key standard ID so that you  
can  
connect your own primary keys instead.

"Will Rails  
ever notice if I fill it’s tables from the “outside” ?  
NO. I really do not think so but if you change the database schema he  
might  
be really angry at you.

“ast question - if I use helpers such as act\_as\_taggable on these  
tables, is it possible to keep the tags in a separate table?”  
I believe the whole IDEA is to store all taggables in a separate table  
because you should not have to change anything in your current databas  
setup.

Good luck!

Read my blogg in English at www.swerails.se

2007/7/18, Ben [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> We will transfer a lot of data (products, customers, invoices, etc.)  
> understand ActiveRecord well enough to see the consequences.
> 
> Ben
> 
> >

## –

Andreas Kviby  
Telefon 070-352 66 76  
E-post removed\_email\_address@domain.invalid
