Quoting Fearless Fool <li...@ruby-forum.com>:
> I don't like this.  This makes me grumpy, and I've even already had my
> morning coffee.
> 
> obs[0] is a PremiseObservation, save! completed without error, yet
> nothing was written to the db.  This is a serious ass-biter:
> 
> irb(main):057:0> PremiseObservation.count
> => 0
> irb(main):058:0> obs =
> PremiseObservation.get_premise_observations(premise) ; obs.size
> => 320
> irb(main):059:0> obs[0].is_a?(PremiseObservation)
> => true
> irb(main):060:0> obs[0].save!
> => true
> irb(main):061:0> PremiseObservation.count
> => 0
> 

Try 'obs[0].touch'.  Quoting the documentation at
http://rails.rubyonrails.org/:

touch(attribute = nil)

Saves the record with the updated_at/on attributes set to the current time. If 
the save fails because of validation errors, an ActiveRecord::RecordInvalid 
exception is raised. If an attribute name is passed, that attribute is used for 
the touch instead of the updated_at/on attributes.

Examples:

  product.touch               # updates updated_at
  product.touch(:designed_at) # updates the designed_at attribute



HTH,
  Jeffrey

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to