Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/generators/casein/scaffold/templates/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ def create
flash[:notice] = '<%= singular_name.humanize.capitalize %> created'
redirect_to casein_<%= @plural_route %>_path
else
flash.now[:warning] = 'There were problems when trying to create a new <%= singular_name.humanize.downcase %>'
warning_msg = "There were problems when trying to create a new<%= singular_name.humanize.downcase %>"
if @<%= singular_name %>.errors
warning_msg += ': "' + @<%= singular_name %>.errors.full_messages.join(' ') + '"'
end
flash.now[:warning] = warning_msg
render :action => :new
end
end
Expand Down Expand Up @@ -57,4 +61,4 @@ def destroy
end

end
end
end