Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[merb_datamapper] Added missing messages in resource controller gener…

…ator
  • Loading branch information...
commit 3f58b968e2a223817cd176f6dcc4587ea31a32c4 1 parent ef036e4
@teamon teamon authored snusnu committed
Showing with 3 additions and 2 deletions.
  1. +3 −2 merb_datamapper/lib/generators/templates/resource_controller.rb
View
5 merb_datamapper/lib/generators/templates/resource_controller.rb
@@ -40,8 +40,9 @@ 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
@@ -50,7 +51,7 @@ 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
Please sign in to comment.
Something went wrong with that request. Please try again.