LoginSignup
5
6

More than 5 years have passed since last update.

Railsで不要なファイルを生成しないようにする

Posted at

rails g controller ××××××× した時に生成されるStylesheetとか必要ない場合

下記のrails newした後のデフォルトの状態

config/application.rb
require_relative 'boot'

require 'rails/all'

# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)

module ×××××××
  class Application < Rails::Application
    # Settings in config/environments/* take precedence over those specified here.
    # Application configuration should go into files in config/initializers
    # -- all .rb files in that directory are automatically loaded.
  end
end

編集後のファイル

config/application.rb
require_relative 'boot'

require 'rails/all'

Bundler.require(*Rails.groups)

module ×××××××
  class Application < Rails::Application
      config.generators do |g|
      g.stylesheets false
      g.javascripts false
      g.helper false
      g.test_framework false
    end
  end
end

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6