caged/lighthouse-api

Issue with #valid? and setting errors on tickets

Closed this issue · 1 comments

Im not sure if this an issue with activeresource or the lighthouse API, but here's what I see...

    ree-1.8.7-2010.02 > ticket = Lighthouse::Ticket.new
     => #<Lighthouse::Ticket:0x1051a7308 @prefix_options={}, @attributes={}> 
    ree-1.8.7-2010.02 > ticket.valid?
     => true 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {}> 
    ree-1.8.7-2010.02 > ticket.errors.add :base, 'this is an invalid ticket'
     => ["this is an invalid ticket"] 
    ree-1.8.7-2010.02 > ticket.valid?
     => true 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {}> 
    ree-1.8.7-2010.02 > ticket = Lighthouse::Ticket.new
     => #<Lighthouse::Ticket:0x105194028 @prefix_options={}, @attributes={}> 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {}> 
    ree-1.8.7-2010.02 > ticket.errors.add :base, 'this is an invalid ticket'
     => ["this is an invalid ticket"] 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {:base=>["this is an invalid ticket"]}> 
    ree-1.8.7-2010.02 > ticket.valid?
     => true 
    ree-1.8.7-2010.02 > ticket.errors
     => #<OrderedHash {}> 

I dug through activeresource a bit - it's #valid? method clears the errors, then runs callbacks to add them back in. Is this an issue with how lighthouse ticket is using that, or with ActiveResource itself?