diff options
author | Yoshiyuki Hirano <yhirano@me.com> | 2017-09-25 02:22:59 +0900 |
---|---|---|
committer | Yoshiyuki Hirano <yhirano@me.com> | 2017-09-25 02:22:59 +0900 |
commit | 11444d7b58948648c3636b920cc839c61aa60c7e (patch) | |
tree | b5745597e1679b6394fed21ff32813b58dd31a77 /railties | |
parent | 6aa56460d54518d126663b1ddc6091330b8d16b4 (diff) | |
download | rails-11444d7b58948648c3636b920cc839c61aa60c7e.tar.gz rails-11444d7b58948648c3636b920cc839c61aa60c7e.tar.bz2 rails-11444d7b58948648c3636b920cc839c61aa60c7e.zip |
Refactor Css::Generators::ScaffoldGenerator
* define source_root by source_root method
* it don't create file, but copy it.
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/css/scaffold/scaffold_generator.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb b/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb index 5996cb1483..d8eb4f2c7b 100644 --- a/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb +++ b/railties/lib/rails/generators/css/scaffold/scaffold_generator.rb @@ -5,13 +5,13 @@ require_relative "../../named_base" module Css # :nodoc: module Generators # :nodoc: class ScaffoldGenerator < Rails::Generators::NamedBase # :nodoc: + source_root Rails::Generators::ScaffoldGenerator.source_root + # In order to allow the Sass generators to pick up the default Rails CSS and # transform it, we leave it in a standard location for the CSS stylesheet # generators to handle. For the simple, default case, just copy it over. def copy_stylesheet - dir = Rails::Generators::ScaffoldGenerator.source_root - file = File.join(dir, "scaffold.css") - create_file "app/assets/stylesheets/scaffold.css", File.read(file) + copy_file "scaffold.css", "app/assets/stylesheets/scaffold.css" end end end |