Sha256: ccb1056964b6f0782dbac0c9efb2f97a075d9891f1eedb4b6496a8c3d2dcf5ed

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

= ar_default_values
initialize with default_values

== sample
you can specify default values with hash:

  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 to ar_default_values

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
* Fork the project.
* Start a feature/bugfix branch.
* Commit and push until you are happy with your contribution.
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

== Copyright

Copyright (c) 2012 masarakki. See LICENSE.txt for
further details.

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ar_default_values-0.3.0 README.rdoc
ar_default_values-0.2.0 README.rdoc