Project

returning

0.0
No commit activity in last 3 years
No release in over 3 years
Simple implementation of RETURNING for ActiveRecord
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0

Runtime

 Project Readme

Hi there,

Returning

It's a simple implementation of the +returning+ for ActiveRecord 3.0 and 3.1.

How to use

Add it to your Gemfile

gem 'returning'

And then

# This sends UPDATE objects SET field = 42 WHERE id = 42 RETURNING generation
object.save(:returning => 'generation') # => #<0xblah Object generation=2>
# This sends DELETE FROM objects WHERE id = 42 RETURNING generation
object.destroy(:returning => 'generation') # => #<0xblah Object generation=3>

It returns readonly object with fields that are specified in the returning option.

Cheers