Comment

Comment by JFlash

The validity of an object depends on the observer. If you require all Customers to have a billing address but a person is in the middle of a multi-page checkout, should their Customer record be invalid if they've only filled in their email so far? What if they want to come back to the form later?

Rails tries to fix this with the `:on` option for validations (http://api.rubyonrails.org/classes/ActiveModel/Validations/C...), which goes woefully unused in Rails apps.

Now you can do:

  customer.save(context: :checking_out)
  # which is different than
  customer.save
parent JFlash 11 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton