Hi all,

What's the expected behavior of adding an error with
@resource.errors.add?  When I attempt it, the record remains in a
valid state and saves without issue.  Here's an example:

class Rate
  include DataMapper::Resource
  property :id, Serial
  property :amount, Integer
  property :ramp, String

  before :save do
    throw :halt unless errors.empty?
  end
end

Rate.auto_migrate!

r = Rate.new(:amount => 150, :ramp => "chicago")
r.errors.add(:ramp, "Ambiguous location.")

r.valid?
#=> true
r.save
#=> true

I would have thought that it would invalidate the record or that I
could catch it in a before :save block.

Thanks,
Jon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to