search for: connectionadapters

Displaying 20 results from an estimated 130 matches for "connectionadapters".

Did you mean: connection_adapters
2006 Aug 19
7
Impossible to get stable?
I have concluded that it is impossible to get this background process stable. I am out of ideas and could really use some help. Here is what I have: 50 workers, just running an infinite loop that constantly calls save! on a model. Keep in mind this is just for testing purposes. I catch all exceptions and put them in the log. I am tried setting allow_concurrency to true and false. Neither
2010 May 28
2
Suggestion for improving value_to_boolean column conversion
...ign "some text" to boolean fields on a model will not generate any validation messages (it will silently be converted to false). I think it is like silently swallowing exception without knowing what to do about them. I will suggest to modify the existing implementation of ActiveRecord::ConnectionAdapters::Column::value_to_boolean to ActiveRecord::ConnectionAdapters::Column.class_eval %q{ def self.value_to_boolean(value) case value when *TRUE_VALUES.to_a: true when *FALSE_VALUES.to_a: false else nil end end } First of all it simplifies the implementation (getting rid of ini...
2006 Aug 02
2
mangle ActiveRecord
Dear Gurus on Rails! How do I change the behaviour of one method in ActiveRecord::ConnectionAdapters::SchemaStatements ? Full story: I''d like to mangle ActiveRecord::ConnectionAdapters::SchemaStatements so when it creates a new sql table, it also (optionally) creates my created_at, deleted, key_id, session_id etc columns that I use on basically all tables. It would not be DRY to repeat t...
2007 Nov 28
0
Where to override ActiveRecord::ConnectionAdapters::SQLServerAdapter?
I''m working on an existing global database running on MS SQL Server. The appropriate primary key is uniqueidentifier, so I want to set ActiveRecord::ConnectionAdapters::SQLServerAdapter#native_database_types[:primary_key] = "uniqueidentifier NOT NULL newid() PRIMARY KEY". Obviously, I need to override the native_database_types definition, but I really don''t know where I should put the code so rails picks it up. I want to do this in migrations...
2008 Mar 19
2
ActiveRecord bug? ActiveRecord::ConnectionAdapters::Column.type_cast for float columns
Hi all, I just noticed that in ActiveRecord::ConnectionAdapters::Column.type_cast[1] (and type_cast_code[2]) the type casting for float columns simply does value.to_f, whereas all the others have a rescue or call out to a method, the default implementations of which have rescues or enough logic in that I don''t think they''d fail. Imagine the f...
2010 Sep 02
1
ActiveRecord::ConnectionAdapters::Column value_to_boolean(value) does not return a boolean value.
value_to_boolean(value), does not always return a boolean value, only when true. 150: def value_to_boolean(value) 151: if value.is_a?(String) && value.blank? 152: nil 153: else 154: TRUE_VALUES.include?(value) 155: end 156: end If value is contained in TRUE_VALUES then it returns true(TrueClass). But if value is
2010 Oct 30
12
Anyone successfully ran JRuby 1.5.3, Rails 3, Tomcat6
Hi, I''ve been trying to get JRuby 1.5.3 with Rails 3 to run on the Tomcat6 server with little success. Has anyone been able to do this? If so, what issues did you have to overcome to get this to work? Also, is this a combination that you would recommend for a production site, or is it all too new and untested? The latest issue I''m stuck on right now is with the mysql-connector-
2005 Apr 23
2
[Tip] Introspection to determine if a column may be null
...wing is a huge hack - suggestions on a cleaner way to add this functionality (without changing the postgresql adaptor itself) are very much welcomed. As our implementations for any other adaptors. # From my own lib/rails_extensions.rb file, included in config/environment.rb class ActiveRecord::ConnectionAdapters::Column def required? @required end end class ActiveRecord::ConnectionAdapters::PostgreSQLAdapter alias_method :_real_columns, :columns def columns( table_name, name=nil ) cols = _real_columns( table_name, name ) cols.each{ |col| sql = "select is_nullable fro...
2009 Sep 28
5
Multi-databases support
Hi, While I was hacking ovirt-server, I have found that it's currently restricted to Postgres DB. Even if I like postgres for serious work on a server, I really prefer to hack/dev locally on a Sqlite or MySQL DB. I have googled on rails in order to find a good answer for the "foreign key problem" which forces OVirt to stay on pg. I have found a plugin on this particular
2007 Oct 08
1
How to get database adapter type programmatically in rails?
...le, so I have to get database adapter type programmatically in my codes to process different native SQL statements. I haven''t found any document for this situation. After some research, I have found a way to do so like following: if ActiveRecord::Base::connection.is_a? (ActiveRecord::ConnectionAdapters::OracleAdapter) {Process native Oracle SQL statements} else if ActiveRecord::Base::connection.is_a? (ActiveRecord::ConnectionAdapters::MysqlAdapter) {Process natvie Mysql SQL statements} end After test, it works. But I am wondering if this is the best way to achieve my goal,...
2008 Jun 24
9
ActiveRecord 2.1 Migration support
...ode keeps looping . Comparing the contents of "options" for MySQL and Ingres I don''t see anything of any significance that would cause the call not to work. Below is a dump of "options" using ruby-debug: MySQL {:default=>nil, :column=>#<struct ActiveRecord::ConnectionAdapters::ColumnDefinition base=#<ActiveRecord::ConnectionAdapters::MysqlAdapter:0xb6fc6f50 @logger=#<ActiveSupport::BufferedLogger:0xb70935f0 @log=#<File:/home/grant/stuff/ruby/rails/auction-demo-mysql/log/development.log>, @no_block=false, @auto_flushing=1, @buffer=[], @level=0>, @r...
2008 Jun 24
9
ActiveRecord 2.1 Migration support
...ode keeps looping . Comparing the contents of "options" for MySQL and Ingres I don''t see anything of any significance that would cause the call not to work. Below is a dump of "options" using ruby-debug: MySQL {:default=>nil, :column=>#<struct ActiveRecord::ConnectionAdapters::ColumnDefinition base=#<ActiveRecord::ConnectionAdapters::MysqlAdapter:0xb6fc6f50 @logger=#<ActiveSupport::BufferedLogger:0xb70935f0 @log=#<File:/home/grant/stuff/ruby/rails/auction-demo-mysql/log/development.log>, @no_block=false, @auto_flushing=1, @buffer=[], @level=0>, @r...
2008 Aug 28
2
1 or true in TINYINT(1) column?
Hello, there is a table that has a column TINYINT(1) called status. Through mysql console I see its value as 1 (when is true) but if I do this in Rails console: Mytable.status => true give me "true" rather "1". How could I change 1 to true using some method? Or true to 1? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are
2008 Feb 26
5
Rails 2.0.2 MySQL 'year' datatype missing from ActiveRecord?
...he ''year'' datatype missing from ActiveRecord in 2.0.2? According to my MySQL 5.0 reference manual, ''year'' is a datatype, but when I try to run a migration that has a t.year column, I get this: rake aborted! undefined method `year'' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x274a070> I opened up the mysql_adapter.rb file in my frozen 2.0.2 ActiveRecord, and sure enough, ''year'' was missing from the native_database_types hash, so I added it. rake db:migrate still doesn''t work (continues to give the same error, and I can...
2006 Jan 13
1
How to disconnect to a database????
...= GenTableAs.new obj1["colaa"] = 100 obj1["colab"] = "100" obj1.save # should have raised exception or error here end end #################################################################################### the output of index @connected1: #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x2aaaac138930 @runtime=0.0189187526702881, @connection=#<PGconn:0x2aaaac138980>, @logger=#<Logger:0x2aaaac2e7fd8 @default_formatter=#<Logger::Formatter:0x2aaaac2e7dd0 @datetime_format=nil>, @progname=nil, @logdev=#<Logger::LogDevice:0x2aaaac2e7ce0 @shift_size=1...
2006 Mar 21
2
Migration ~ Create
...self.up User.create :name => ''John Kopanas'', :email => ''john@kopanas.com'', :password => ''test'' end =========== When I run it I get the following error: =========== undefined method `create'' for #<ActiveRecord::ConnectionAdapters::MysqlAdapter:0x2345c1c> =========== When I copy the line and paste it in console it works perfectly. Even using the longer method of =========== user = User.new user.name user.save =========== Does not work in the migration. Tells me method name does not exist. It exists. Anyone have...
2008 Jan 16
0
[CruiseControl] RubyOnRails build 8649 failed
...active_support/testing/setup_and_teardown.rb:90:in `run'' Name: test_add_column_not_null_with_default(MigrationTest) Type: Failure Message: Exception raised: Class: <NameError> Message: <"undefined local variable or method `quoted_column_name'' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0xb74d5154>"> ---Backtrace--- ./test/../lib/active_record/connection_adapters/postgresql_adapter.rb:597:in `add_column'' ./test/migration_test.rb:209:in `test_add_column_not_null_with_default'' ./test/migration_test.rb:209:in `test_add_column_not_null_w...
2006 Aug 08
2
Problem with plurals, migrations?
...ecord::Base set_table_name "hardware" has_many :schedules end When I run the migration the table creation occurs, but then I get this error: -- create({:vendor=>"Foo", :model=>"Bar"}) rake aborted! undefined method `create'' for #<ActiveRecord::ConnectionAdapters::PostgreSQLAdapter:0x39293cc> My guess is that it was expecting a "hardwares" table instead of "hardware", and is getting confused. But, I didn''t see a method in the docs to set the table name ala ActiveRecord. Or am I missing something obvious here? I checked th...
2009 Sep 08
2
Rails + Sybase ASE : group effort, please
...nection( :adapter => "sybase", :host => "localhost", :port => 123, :username => "read_only", :password => "read_only", :database => "mydb" ) puts a puts a.connection _________ Here is the output: #<ActiveRecord::ConnectionAdapters::ConnectionPool:0x3e1b740> c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybct.rb:27:in `connect'': connect failed (RuntimeError) from c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybct.rb:27:in `open'' from c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt/sybsql.rb:269:in...
2006 Jan 09
3
rails ignoring the migration file
...y is this not what I wanted because it removes the size restrictions it also blows up when you try to do rake db_import_schema with this error: site_path>rake db_schema_import (in D:/sites/itsthes/itsthes-ruby/itsthes) rake aborted! undefined method `string_to_binary'' for ActiveRecord::ConnectionAdapters::ColumnDefinition:Class Is anyone else know why this is happening? Does anyone else have a problem with rails converting values in the schema.rb to something other than what is in the migration file? Thanks, Mark -- -------------------------------------------------------------------- I am Mark...