Skip to content

Commit cc88fcf

Browse files
committed
Fixes rails#4764 - remove generated new line in routes.rb on scaffold generation
As explained in rails#4764, when destroying a scaffold, routes.rb loses a new line. This seems to happen because a new line is added while generating the route and the destroy generator removes it. However, this causes a problem if the routes file is manually edited to remove such new lines. This commit just removes that extra new line from added in the first place.
1 parent a0ff270 commit cc88fcf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

railties/lib/rails/generators/actions.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def route(routing_code)
246246
sentinel = /\.routes\.draw do\s*$/
247247

248248
in_root do
249-
inject_into_file 'config/routes.rb', "\n #{routing_code}\n", { :after => sentinel, :verbose => false }
249+
inject_into_file 'config/routes.rb', "\n #{routing_code}", { :after => sentinel, :verbose => false }
250250
end
251251
end
252252

0 commit comments

Comments
 (0)