Sha256: e0ade8c2e79ac915fb4dd7da467bf9cda8be0891332ebe658405328afdef4c47
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
[![Build Status](https://travis-ci.org/masarakki/ar_default_values.svg?branch=master)](https://travis-ci.org/masarakki/ar_default_values) [![Dependency Status](https://gemnasium.com/masarakki/ar_default_values.svg)](https://gemnasium.com/masarakki/ar_default_values) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/masarakki/ar_default_values/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/masarakki/ar_default_values/?branch=master) [![Coverage Status](https://coveralls.io/repos/masarakki/ar_default_values/badge.png?branch=master)](https://coveralls.io/r/masarakki/ar_default_values?branch=master) # DefaultValues initialize with default_values ## Installation Add this line to your application's Gemfile: gem 'ar_default_values' And then execute: $ bundle Or install it yourself as: $ gem install ar_default_values ## Usage you can specify default values with hash: ```ruby class Book < ActiveRecord::Base default_values rating: 'r18', type: 'comic' do t = Time.now { :released_at => t, :edition_updated_at => t } end end book = Book.new book.rating # => "r18" book.type # => "comic" book.title # => nil book.released_at == book.edition_updated_at # => true ``` ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ar_default_values-0.5.2 | README.md |