Rails scaffold without the css file?

后端 未结 3 1480
心在旅途
心在旅途 2020-12-09 08:39

Is there a way to generate a scaffold in rails 3.0 so that scaffold.css does NOT get created? Something at the command line I can enter to skip that step?

Thanks

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 09:29

    Since Rails 5.0, there is a configuration in config/application.rb which specifically disables generating the app/assets/stylesheets/scaffolds.css, but still generates the stylesheets for your new resource:

    config.generators do |g|
      g.scaffold_stylesheet false
    end
    

    You can also pass it in as the --no-scaffold-stylesheet command line option:

    rails generate scaffold post title body:text --no-scaffold-stylesheet
    

提交回复
热议问题