Giter Site home page Giter Site logo

acts-as-importable's Introduction

Acts as Importable

Originally written for Rails 2 / Ruby 1.8 by Tim Riley.
Updated to Rails 3 by Joe Martinez.
Updated to Ruby 1.9.2 by Pranas Kiziela.
Coverage improved and additional hooks added by Brandon Valentine.

Taste's good with Joe Martinez' model_mill gem.

Importing Legacy Data in Rails is currently the best source of documentation.

I (Brandon) have added a before_import hook, as well as before_import and after_import methods that can be defined on the legacy class. If defined, the class methods are called before and after import_all and import_all_in_batches. The instance method after_import is passed the new model object, and the class method after_import is passed an array of new model objects if and only if it's called from import_all. import_all_in_batches is designed to save memory with large data sets, and thus passing the entire set of new model objects would defeat this goal.

This stuff is still a bit rough, but the specs pass, the coverage is much improved, and I can move on and use this in production.

TODO:

Refactor to use AR-style hooks, rather than relying on specially named methods. That's a lame-o approach.

Copyright (c) 2009 Tim Riley, released under the MIT license
Some bits Copyright (c) 2011 Joe Martinez, released under the same
Some other bits Copyright (c) 2011 Pranas Kiziela, released under the same
Yet more bits Copyright (c) 2011 Brandon Valentine, released under the same

acts-as-importable's People

Contributors

bad avatar bval avatar capitalist avatar pranas avatar timriley avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

voondo

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.