Frederick Cheung wrote: > On Oct 18, 5:56�pm, Greg Willits <[email protected]> > wrote: >> The model in question requires a specific named connection in order to >> use a specific database (multi-db application). Of course, using >> AR::Base.connection wasn't using the correct db. >> > in that case won't some_object.class.connection be a connection to the > correct database for some_object ?
I'm already in a class method at that point, so .class isn't needed. It made sense to me that self.connection.execute should have worked, but it didn't. I didn't investigate further as so far it looks like a regular .save(false) is going to meet my needs. I was originally doing a straight update of some lock control fields without invoking a save of any other attributes, validation, or changes to lock_version (because the latter would cause logic problems if the field existed). It's apparent now no other attributes will have been modified at the point of my query, a save(false) will avoid validation, and lock_version will never exist in my apps, and it really shouldn't exist if the model is using my pessimistic system anyway. So, I just added some callbacks where someone can handle lock_version or anything else before/after my lock/unlock steps. -- gw -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

