andorov
andorov

Reputation: 4336

Rails generate model with default parent

I have a base model MyAppRecordBase which inherits from ActiveRecord::Base and which all other models inherit from. How do I set a default parent model for rails generate model XYZ?

Upvotes: 0

Views: 829

Answers (1)

andorov
andorov

Reputation: 4336

Set the following in environments/development.rb

  config.generators.active_record[:parent] = 'MyAppRecordBase'

Alternatively you can set it on the command line with

rails generate model Dog --parent MyAppRecordBase

Upvotes: 2

Related Questions