Hello, I''m running an environment with connections to different types of databases (using AR) in addition to the default mysql(5) connection. The MSSQL-Connections are working fine. Just one "old" 3rd party database makes problems: an old mysql(4) database. The problem is, that there are colums of type tinyint(1) which gets by default translated to boolean. As the mysql(5) environment uses the same connection adapter I cannot simply set emulate_booleans globally to false via environment.rb (somewhere the boolean mapping is used) . As all these 3rd party connections are established using establish_connection blocks I tried to set this there... but it seems to be ignored, as I''m still stopped with ''ArgumentError: binary columns cannot have a default value: "0"'', which for my understanding should not occur when setting the emulation to false... Where''s my fault? Or is it impossible to set this behavior (briefly said) Model/Connection wise ?! Thanks for any idea! Christian Meyer Web-Application-Developer -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 12, 11:25 pm, nerd <nerd1...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> Hello, > I''m running an environment with connections to different types of > databases (using AR) in addition to the default mysql(5) connection. > The MSSQL-Connections are working fine. Just one "old" 3rd party > database makes problems: an old mysql(4) database. The problem is, > that there are colums of type tinyint(1) which gets by default > translated to boolean. As the mysql(5) environment uses the same > connection adapter I cannot simply set emulate_booleans globally to > false via environment.rb (somewhere the boolean mapping is used) . As > all these 3rd party connections are established using > establish_connection blocks I tried to set this there... but it seems > to be ignored, as I''m still stopped with ''ArgumentError: binary > columns cannot have a default value: "0"'', which for my understanding > should not occur when setting the emulation to false... > Where''s my fault? Or is it impossible to set this behavior (briefly > said) Model/Connection wise ?!Dumb suggestion: class LegacyMysqlAdapter < ActiveRecord::ConnectionAdapters::MysqlAdapter def self.emulate_booleans false ense end then set the appropriate database connection''s adapter to legacy_mysql Fred> > Thanks for any idea! > > Christian Meyer > Web-Application-Developer-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 13 Jan., 11:57, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Dumb suggestion: > > class LegacyMysqlAdapter < > ActiveRecord::ConnectionAdapters::MysqlAdapter > def self.emulate_booleans > false > ense > end > > then set the appropriate database connection''s adapter to legacy_mysqlI already tried this kind of easy solution... but this fails as establish_connection from activerecord/lib/active_record/ connection_adapters/abstract/connection_specification.rb tries to load an gem with this name... Christian Meyer -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 14, 1:06 pm, nerd <nerd1...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 13 Jan., 11:57, Frederick Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > then set the appropriate database connection''s adapter to legacy_mysql > > I already tried this kind of easy solution... but this fails as > establish_connection from activerecord/lib/active_record/ > connection_adapters/abstract/connection_specification.rb tries to load > an gem with this name... >Then stick the above in a gem (and perhaps then vendor it into your app) Fred> Christian Meyer-- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.