Encrypting data
Having just finished adding attr_encrypted to some models, I've come to think that a hackers job might not be that hard.
I've got a database on a different server to the app servers - however, chances are that if someone managed to get on to the db server, that person could also access the app server where the keys are stored (perhaps that assumption is incorrect) as they have the same type of security measures.
Issue
Rails code is stored in a readable text format on the server, therefore the secret keys can be accessed. Surely if someone did get a hold of the database, and a hold of those keys the entire encryption of data becomes irrelevant as it simply (slightly) prolongs the hackers time to decrypt information.
If so, are there further security measure that can be taken, or have I completely missed the concept of encryption?
I've had a look around the attr_encrypted gem and associated readme and questions but could not find anything useful.