Class: ModelFromTableGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ModelFromTableGenerator
- Defined in:
- lib/generators/model_from_table_generator.rb
Defined Under Namespace
Classes: Resource
Instance Method Summary collapse
Instance Method Details
#create_model_file ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/generators/model_from_table_generator.rb', line 4 def create_model_file ignore_table_names = %w(schema_migrations) resources = ActiveRecord::Base.connection.tables.map do |table_name| Resource.new ActiveRecord::Base.connection, table_name end resources.each do |resource| next if ignore_table_names.include? resource.table_name @resource = resource template "model.rb", resource.file_path end end |