This project is archived and is in readonly mode.

#6041 ✓resolved
Matt Jankowski

ActiveResource validations

Reported by Matt Jankowski | November 23rd, 2010 @ 01:16 AM

I expected to have invalid records when I added to errors locally, regardless of contacting the server - is that inaccurate?

    ruby-1.8.7-p302 > class Widget < ActiveResource::Base
    ruby-1.8.7-p302 ?>  end
     => nil 
    ruby-1.8.7-p302 > 
    ruby-1.8.7-p302 >   widget = Widget.new
     => #<Widget:0x10522dd40 @prefix_options={}, @attributes={}> 
    ruby-1.8.7-p302 > widget.errors
     => #<OrderedHash {}> 
    ruby-1.8.7-p302 > widget.valid?
     => true 
    ruby-1.8.7-p302 > widget.errors
     => #<OrderedHash {}> 
    ruby-1.8.7-p302 > widget.errors.add :base, 'invalid'
     => ["invalid"] 
    ruby-1.8.7-p302 > widget.errors
     => #<OrderedHash {:base=>["invalid"]}> 
    ruby-1.8.7-p302 > widget.valid?
     => true 
    ruby-1.8.7-p302 > widget.errors
     => #<OrderedHash {}>

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages