ConflictDetector is a convenience class for saving the record, or returning the conflict.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
LICENSE
README.md
Rakefile
conflict_detector.gemspec

README.md

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