David
David

Reputation: 71

Rails generate model + migration for subclass

I have a base model MyAppRecordBase which inherits from ActiveRecord::Base and which all other models inherit from. I used (in config/environments/development.rb) config.generators.active_record[:parent] = 'MyAppRecordBase' to make it default. How do I make rails generate model XYZ to create a migration file for new models (it do all exept creating migration file..)?

Upvotes: 2

Views: 984

Answers (2)

David
David

Reputation: 71

Well, after searching for solutions, I used ActiveSupport::Concern as mentioned in this answer by @HarishShetty, And it solve it.

Upvotes: 0

Ahmed Samir Shahin
Ahmed Samir Shahin

Reputation: 558

try scaffolding:

rails g scaffold MODEL_NAME

Upvotes: 1

Related Questions