No commit activity in last 3 years
No release in over 3 years
Allow to use update_or_create when db:seed or sometime.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 4.1.0
>= 0
 Project Readme

UpdateOrCreate

DB utility plugin for ActiveRecord

update_or_create allows update_or_create to ActiveRecord. And allows db:seed extension to Rake. Very useful when use seeds.rb.

Install

  • Add
gem 'update_or_delete_or_create'

to Gemfile.

Usage

  • add require 'update_or_create' to seeds.rb.
  • Model.update_or_create([id: 1, value: 'test'], or etc...])
  • When set { id: 4, 'delete record !!!' => true }, then record of "id=4" will be deleted.
  • Make db/seeds/ext.rb(or etc) are same grammer as seeds.rb, then you can extra seed file as rake db:seed:ext command.

System requirement

  • Ruby 2.0 or later.
  • RoR 4.1 or later.

License

Copyright © 2014 Jun’ya Shimoda(JironBach)
Dual licensed under the MIT license and GPL license.