README.md in simple_model-0.2.6 vs README.md in simple_model-1.0.0

- old
+ new

@@ -14,25 +14,55 @@ ## Usage ### Basic require 'simple_model' class Item < SimpleModel::Base + save :save_item, :rollback => :undo_save has_booleans :active, :default => true has_booleans :paid has_currency :price, :default => 10.0 - has_dates :created_at + has_times :created_at, :default => :now validates_inclusion_of :price, :in => 10..25 + + def now + Time.now + end + + def file_name + @file_name ||= "receipt-#{self.created_at.to_i}.txt" + end + + def save_item + begin + File.open(self.file_name, 'w') do |receipt| + receipt.puts self.created_at + receipt.puts "price:#{self.price}" + receipt.puts "paid:#{self.paid}" + end + rescue + return false + end + true + end + + def undo_save + File.delete(file_name) + end end - item = Item.new(:created_at => "12/30/2010") - item.created_at # => #<Date: 2010-12-30 (4911121/2,0,2299161)> + item = Item.new + item.created_at # => 2011-10-23 21:56:07 -0500 + item.created_at # => 2011-10-23 21:56:08 -0500 item.active # => true item.paid # => nil item.paid? # => false item.price # => 10.0 item.price = '$1,024.00' item.price # => #<BigDecimal:100c989d8,'0.1024E4',9(27)> item.valid? # => false + item.price = 15 + item.save # => true + ## Contributing to simple_model * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet