Search code examples
ruby-on-railsrubydatabase-migration

Is there any way for not to generate migration files in rails


I am using graph database using rails. I don't want to generate migration while generating models. I know there is a options like rails g model user --skip-migration. But I am searching for permanent solutions what I do not need to specify --skip-migration every time while generating model.


Solution

  • Yes. You can customize default rails generators (http://guides.rubyonrails.org/generators.html#customizing-your-workflow). It's actually quite easy. Just add following snippet into your config/application.rb:

    config.generators do |g|
      g.orm :active_record, migration: false      
    end
    

    This tells Rails to use ActiveRecord as an ORM but to skip generation of migrations.