Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion lib/generators/rails/templates/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def destroy
@<%= orm_instance.destroy %>

respond_to do |format|
format.html { redirect_to <%= index_helper %>_path, notice: <%= %("#{human_name} was successfully destroyed.") %> }
format.html { redirect_to <%= index_helper %>_path, status: :see_other, notice: <%= %("#{human_name} was successfully destroyed.") %> }
format.json { head :no_content }
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/scaffold_controller_generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase

assert_instance_method :destroy, content do |m|
assert_match %r{@post\.destroy}, m
assert_match %r{format\.html \{ redirect_to posts_path, notice: "Post was successfully destroyed\." \}}, m
assert_match %r{format\.html \{ redirect_to posts_path, status: :see_other, notice: "Post was successfully destroyed\." \}}, m
assert_match %r{format\.json \{ head :no_content \}}, m
end

Expand All @@ -72,7 +72,7 @@ class ScaffoldControllerGeneratorTest < Rails::Generators::TestCase
end

assert_instance_method :destroy, content do |m|
assert_match %r{format\.html \{ redirect_to admin_posts_path, notice: "Post was successfully destroyed\." \}}, m
assert_match %r{format\.html \{ redirect_to admin_posts_path, status: :see_other, notice: "Post was successfully destroyed\." \}}, m
end
end
end
Expand Down