Rails scaffold without the css file?

后端 未结 3 1486
心在旅途
心在旅途 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:20

    You can also disable it by default -- in config/application.rb:

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

    Rails itself only uses it for scaffold.css AFAIK, but unfortunately the same hook could be used by other generators, so you might need to remember to pass --stylesheets for a third-party gem that generates assets, for instance. It'd be really nice if Rails had an explicit option for scaffold.css :-/

    You can find other generator options in the Rails Guides, by the way. Helpers are nice to turn off by default and generate them when you actually want them.

提交回复
热议问题