Skip to content

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

License

Notifications You must be signed in to change notification settings

jensb/create_or_update_by

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 <[email protected]>, released under the MIT license.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages