Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes #4764 - remove generated new line in routes.rb on scaffold generation #4765

Merged
merged 1 commit into from

2 participants

@vijaydev
Collaborator

As explained in #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.

@vijaydev vijaydev Fixes #4764 - remove generated new line in routes.rb on scaffold gene…
…ration

As explained in #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.
cc88fcf
@spastorino spastorino merged commit 7cdb122 into rails:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 30, 2012
  1. @vijaydev

    Fixes #4764 - remove generated new line in routes.rb on scaffold gene…

    vijaydev authored
    …ration
    
    As explained in #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.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  railties/lib/rails/generators/actions.rb
View
2  railties/lib/rails/generators/actions.rb
@@ -246,7 +246,7 @@ def route(routing_code)
sentinel = /\.routes\.draw do\s*$/
in_root do
- inject_into_file 'config/routes.rb', "\n #{routing_code}\n", { :after => sentinel, :verbose => false }
+ inject_into_file 'config/routes.rb', "\n #{routing_code}", { :after => sentinel, :verbose => false }
end
end
Something went wrong with that request. Please try again.