lib/generators/templates/resource_controller.rb in merb_datamapper-1.0.15 vs lib/generators/templates/resource_controller.rb in merb_datamapper-1.1.0.pre

- old
+ new

@@ -38,20 +38,21 @@ def update(id, <%= singular_model %>) @<%= singular_model %> = <%= model_class_name %>.get(id) raise NotFound unless @<%= singular_model %> if @<%= singular_model %>.update(<%= singular_model %>) - redirect resource(@<%= singular_model %>) + redirect resource(@<%= singular_model %>), :message => {:notice => "<%= model_class_name %> was successfully updated"} else + message[:error] = "<%= model_class_name %> failed to be updated" display @<%= singular_model %>, :edit end end def destroy(id) @<%= singular_model %> = <%= model_class_name %>.get(id) raise NotFound unless @<%= singular_model %> if @<%= singular_model %>.destroy - redirect resource(:<%= plural_model %>) + redirect resource(:<%= plural_model %>), :message => {:notice => "<%= model_class_name %> was successfully deleted"} else raise InternalServerError end end