Can you use valid? function valid? to find out if the object is valid for operations. Here is an example of code that implements this approach:
def create # change_some_db_values buyer = Buyer.new(params[:buyer]) if buyer.valid? change_some_db_values end if buyer.save redirect_to(:action => 'index') else render('new') end end
source share