ennova / conflict_detector

ConflictDetector is a convenience class for saving the record, or returning the conflict.

Home Page:https://rubygems.org/gems/conflict_detector

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conflict Detector

ConflictDetector is a convenience class for saving the record, or returning the conflict.

Installation

Add this line to your application's Gemfile:

gem 'conflict_detector'

Usage

def create
  @post = Post.build(params[:post])
  detector = ConflictDetector.new(@post, :title, :content, :user_id)
  @post = detector.conflicting_or_created_record
  respond_with @post, :status => detector.status
end

About

ConflictDetector is a convenience class for saving the record, or returning the conflict.

https://rubygems.org/gems/conflict_detector

License:MIT License


Languages

Language:Ruby 100.0%