13

When I scaffold I don't want it to generate these files:

invoke    jbuilder
create      app/views/tests/index.json.jbuilder
create      app/views/tests/show.json.jbuilder

But how? in my application.rb I have this:

config.generators do |g|
  g.assets            false
  g.helper            false
  g.test_framework    nil
end
lulalala
  • 15,996
  • 12
  • 101
  • 165

2 Answers2

27

Use

config.generators.jbuilder = false

or

config.generators do |g|
  g.assets            false
  g.helper            false
  g.test_framework    nil
  g.jbuilder          false
end
Kirti Thorat
  • 50,170
  • 10
  • 97
  • 103
  • 1
    According to this [article](http://rubyjunky.com/rails-scaffold-dangerous-defaults.html), you'll also need to change your routes to constraint the format to ony html. Otherwise, you'll get 500 error when trying to access the json route. – konyak Oct 02 '15 at 20:35
  • For Rails 5 users still not able to disable jbuilder, downgrade thor: http://stackoverflow.com/questions/40986923/meaning-of-expected-string-default-value-for-on-ruby-on-rails/41035588#41035588. – d_rail Jan 18 '17 at 01:41
1

Deleting or commenting out jbuilder from you Gemfile will do the trick.

https://stackoverflow.com/a/24104811/5521564

Community
  • 1
  • 1
Matthias
  • 1,573
  • 2
  • 14
  • 28