Skip to content

About

Extends Ruby on Rails's ActiveRecord::Base to mimick MySQLs "REPLACE INTO" for all databases.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CreateOrUpdateBy
================

This plugin mimicks something like MySQL REPLACE INTO mechanism, in which you
can specify a primary key, and depending on whether a record exists already, it
will be replaced or newly created.

This plugin does the same, but allows not only primary keys to be specified as search
conditions, but ANY column, or ANY two columns.

Idea and longer introduction:
  http://www.intridea.com/2008/2/19/activerecord-base-create_or_update-on-steroids-2

Idea for extension to include two find parameters / conditions (found via Google):
  http://github.com/jeremymcanally/docbox/tree/57215361c3a585a9608bee25cd6e4659c780ff17/lib/core_ext.rb

Tests, pluginization and documentation: me.


Copyright (c) 2009 Jens Benecke <jens-rails@spamfreemail.de>, released under the MIT license.

About

Extends Ruby on Rails's ActiveRecord::Base to mimick MySQLs "REPLACE INTO" for all databases.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages