ChuckE
unread,Oct 15, 2012, 12:04:21 PM10/15/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rubyonra...@googlegroups.com
Hi,
I found a special ActiveRecord case which messes a bit one requirement. I have two applications sharing the same DB. For this reason we found wise to share the DB mapping logic among both applications, namely, our activerecord models. After extracting them into a gem and bundling them into the two applications, everything went well.
Now, we found out it would also be wise to share the migrations, schema, config, etc., maybe "delegate" such rake tasks as create migration and schema dump to that shared repo, which would contain also this part of the logic. Thing is, the use of the Rails class throughout all the rake tasks concerning migrations make that impossible. Specially the load_config rake task, which is apparently run before each and every rake task. This one basically overwrites any rewrite I might have had done on the ActiveRecord::Migrator.migration_paths with the local 'db/migrate' folder. Which in my case would be empty in both application trees and full on the shared repo. Because of that, I can't wisely set a new migration path without entering a world of hurt and non-stop monkey patch. Which I'll avoid by now. But basically, that load_config rake_task is messing up my plans.
Another concern is the use of the Rails class itself. It could be the case that I would be talking about two rails applications, but one of them happens to be Sinatra, which doesn't own (or shouldn't own) any Rails class. I've seen how they extended the migrations part for their version of active record. Also a very limiting solution. So, I guess the solution will probably not come from the frameworks readapting their needs to activerecord, but activerecord having a consistent solution in its box, making it then more extendable for other frameworks (I don't know how Merb handles this, I might investigate into that).
So, I'd like to open the debate on the subject. Or maybe it has been opened previously. I'd much like to hear your opinion.
Regards,
Tiago