Я создаю приложение rails с географическими местоположениями, используя atial_adapter и GeoRuby. При запуске самого приложения в режиме разработки все работает нормально, но при попытке использовать фиксации YAML я получаю синтаксическую ошибку MySQL. Я использую следующее приспособление:
one:
name: Event One
starts_at: 2011-04-20 12:00:00
ends_at: 2011-04-20 16:00:00
topics:
- topic1
- topic2
pos: !ruby/object:Point
x: 10
y: 10
Выполнение этого с Test::Ruby
или RSpec выдает следующую ошибку:
ActiveRecord::StatementInvalid: Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds
to your MySQL server version for the right syntax to use near '), '2011-05-05 20:57:34', '2011-05-05 20:57:34', 908014535)'
at line 1: INSERT INTO `events` (`name`, `starts_at`, `ends_at`, `pos`, `created_at`, `updated_at`, `id`) VALUES ('Lindy Jam', '2011-04-20 12:00:00', '2011-04-20 16:00:00', GeomFromWKB(0x010100000000000000000024400000000000002440,), '2011-05-05 20:57:34', '2011-05-05 20:57:34', 908014535)
Ключ, кажется, в этой точке:
GeomFromWKB(0x010100000000000000000024400000000000002440,),
С лишней запятой в скобках. Я не знаю, откуда это исходит, но он работает для обычных вставок в приложение режима разработки.
Трассировка стека:
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract_adapter.rb:207:in `rescue in log'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract_adapter.rb:199:in `log'
/var/lib/gems/1.9.1/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:314:in `execute'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/database_statements.rb:239:in `insert_fixture'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:646:in `block in insert_fixtures'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:582:in `each'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:582:in `insert_fixtures'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:526:in `block (4 levels) in create_fixtures'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:526:in `each'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:526:in `block (3 levels) in create_fixtures'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/connection_adapters/abstract/database_statements.rb:139:in `transaction'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:524:in `block (2 levels) in create_fixtures'
/var/lib/gems/1.9.1/gems/mysql2-0.2.6/lib/active_record/connection_adapters/mysql2_adapter.rb:232:in `disable_referential_integrity'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:515:in `block in create_fixtures'
/var/lib/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/benchmarkable.rb:55:in `silence'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:514:in `create_fixtures'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:973:in `load_fixtures'
/var/lib/gems/1.9.1/gems/activerecord-3.0.7/lib/active_record/fixtures.rb:938:in `setup_fixtures'
/var/lib/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/callbacks.rb:425:in `_run_setup_callbacks'
/var/lib/gems/1.9.1/gems/activesupport-3.0.7/lib/active_support/testing/setup_and_teardown.rb:34:in `run'
Я использую rails 3.0.7 с Ruby 1.9.2 в Ubuntu 11.04.