zdennis/activerecord-import — pull request #79 by spectator (2013-02-15 01:09:25+00:00)
Title: Rails 4 support

Hi Dennis,

This is still work in progress, however I'm not sure if I'll have enough time to figure out all outstanding issues. Hopefully, with your knowledge and help I will be able to finish this up.

Let me outline changes included

* Replace Jeweler with regular gemspec. Sorry for breaking your workflow, however Jeweler stands in the way more than helping. Good thing, that rubygems + bundler can do everything you used to with few commands.
* Added Appraisal to help with switching back and forth between tests on Rails 3 and Rails 4. You can run that with `bundle exec rake appraisal:rails4 test:mysql2`, `bundle exec rake appraisal:rails3 test:mysql2`, etc.
* Updated AR syntax to Rails 3 and Rails 4 preferred syntax.
* Updated FactoryGirl.
* Updated database.yml to avoid some issues with merging keys.
* Fixed few issues for Rails 4 and updated tests.

There were more changes, commit messages have some more details.

Outstanding issues

Running tests on Rails 4 with mysql2 or mysql adapters `bundle exec rake appraisal:rails4 test:mysql2` I get this

```shell
1) Error:
test: #import with :synchronization option synchronizes passed in ActiveRecord model instances with the data just imported(#):
ActiveRecord::StatementInvalid: Mysql2::Error: Field 'title' doesn't have a default value: INSERT INTO `topics` (`id`,`author_name`,`created_on`,`created_at`,`updated_on`,`updated_at`) VALUES (100,'Jerry Carter','2013-02-15 00:49:21','2013-02-15 00:49:21','2013-02-15 00:49:21','2013-02-15 00:49:21'),(101,'Chad Fowler','2013-02-15 00:49:21','2013-02-15 00:49:21','2013-02-15 00:49:21','2013-02-15 00:49:21') ON DUPLICATE KEY UPDATE `topics`.`author_name`=VALUES(`author_name`),`topics`.`updated_on`=VALUES(`updated_on`),`topics`.`updated_at`=VALUES(`updated_at`)
```

but still cannot figure out where the issue it. It works on Rails 3 with mysql2 and Rails 4 with other adapters.

Another issue is seamless_database_pool adapter which is not ready for Rails 4 yet. I'll try do something with that.

Would appreciate any help to get this done.