module DbStructureWriter::Generate

Attributes

tables[RW]

Public Class Methods

html() click to toggle source
# File lib/db_structure_writer/generate.rb, line 8
def html
  str = Template.generate(table_list)
  file_put(str)
end

Private Class Methods

file_put(str) click to toggle source
# File lib/db_structure_writer/generate.rb, line 18
def file_put(str)
  puts 'file put'
  file_path = "./db/#{Rails.application.class.parent_name}_db_tables.html".downcase
  f = File.open(file_path, 'w')
  f.puts str
  f.close
  p "generated #{file_path}"
end
table_list() click to toggle source
# File lib/db_structure_writer/generate.rb, line 14
def table_list
  @tables ||= ActiveRecord::Base.connection.tables
end