Bare with me on this one.... We have a lot of read only data. And it is accessed a lot more then the user created data at this stage. The datbase structure is (on production):
production_user db 2 production_read_only databases behind HAProxy So some models make a connection to the read_only databases through HAproxy, which all works great. The issue is that some of the user created data that is stored in the production_user db needs to be joined to the read only database at times. So the scenario might be: You have 5 kinds of apples all stored in the read only database, they don't change often. But, a user comes and creates an account and picks his/her favorite apples and saves that config. On development you can use has_and_belongs_to_many for both the user and apples and it works great, all one database. But, on production I need to store: 1) The user account on the production_user db 2) the HABTM table on the user db because the read only databases are optimized for reads only and there are a lot of searches going on for apples apparently :) But, the apples themselves are on the read only database. So if I say apples.users or users.apples i need to make connections to pull the interesting ides out of the corresponding tables, and make connections to the other databases in order to get my data. I could use a lot of apple.users_from_production if RAILS_ENV == 'production' apple.users unless RAILS_ENV == 'production' all over the place, but that seems hokie. Anyone else had to do this and what was your solution? Any help would be appreciated. Another solution would be helpful too, but the database structure is pretty well set. The readonly side needs to be very scalable and nodes need to be able to disappear and reappear based on load, hence haproxy so I can't 'just go to one db and use memcache everywhere'. :D Thanks. Erik --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

