Last modified 2 years ago
Validation
Chudongotnoname
Say that our service validates the data that we send it. For this example, let's assume that the person's name is required. The changes in our rails application are simple. Open app/models/person.rb and make it look like this:
class Person < ActiveRecord::Base validates_presence_of :name end
Now when we do this in our Java code:
p = pf.instantiate();
p.setBirthdate(new Date());
if (p.save()) {
// you are on the list
} else {
// chudongotnoname
}
we can figure out if the person got saved or not, and act accordingly.
