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..)?
            Asked
            
        
        
            Active
            
        
            Viewed 951 times
        
    2
            
            
         
    
    
        David
        
- 71
- 5
2 Answers
1
            
            
        try scaffolding:
rails g scaffold MODEL_NAME
 
    
    
        Ahmed Samir Shahin
        
- 548
- 4
- 15
- 
                    Thanks, @AhmedSamirShahin, it did the job, But I don`t want it to generate the all scaffold files.. – David Dec 14 '14 at 09:59
0
            Well, after searching for solutions, I used ActiveSupport::Concern as mentioned in this answer by @HarishShetty, And it solve it.
- 
                    2I believe the issue you were facing is that when you subclass a model in rails that by default it will use the parent class's database tables. Therefore the generator doesn't think that it needs to create the migration file. – darkrat Dec 21 '14 at 04:07
