07.0.0 Use Server Side Validation - bazzel/ember2-workshop GitHub Wiki
- Add Server Side Validation
See the installation instructions. Use tag 7.0.0.
- Open
backend/app/models/product.rb
and maketitle
a required attribute:
class Product < ActiveRecord::Base
validates :title, presence: true
end
- Open the app, edit a product, leave the title empty and save it.
- Inspect the error shown in the Console tab in the browser. There's an error telling that the backend did not save the record. Let's use this error and show it to the user.
- Open
frontend/app/templates/products/show.hbs
and update the markup for the title field in the form: