No commit activity in last 3 years
No release in over 3 years
Collection of utility Ruby Features for ActiveRecord.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.2.13
 Project Readme

Activerecord Devkit

Version Build Climate Coverage

ActiveRecord DevKit is a package of utility Ruby Features for ActiveRecord.

requirements

Getting started

Add to your Gemfile:

gem 'activerecord-devkit'

Run the bundle command to install it.

For Rails projects, gun generator:

rails generate ruby_features:install

and apply required features in config/initializers/ruby-features.rb:

RubyFeatures.apply('activerecord_devkit/association_soft_build')

For no-Rails usage, apply required features just like:

require 'activerecord-devkit'

RubyFeatures.apply('activerecord_devkit/association_soft_build')

Features

activerecord_devkit/association_soft_build

Makes possible to build associated object without affecting to parent object's association scope:

user = User.first

## Regular build, user.roles.size going to be incremented
new_role = user.roles.build

## Soft build, user.roles.size will stay as is
new_role = user.roles.soft_build
# or
new_role = user.association(:roles).soft_build
# or
new_role = user.roles.where(name: 'admin').soft_build

License

MIT License. Copyright (c) 2015 Sergey Tokarenko