Module: ActiveHashExt::ClassMethods
- Defined in:
- lib/active_hash_ext.rb
Instance Method Summary collapse
Instance Method Details
#destroy_all ⇒ Object
23 24 25 |
# File 'lib/active_hash_ext.rb', line 23 def destroy_all delete_all end |
#read_schema(table, path) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/active_hash_ext.rb', line 10 def read_schema(table, path) tables = File.read(path).split(/^\s*create_/)[1..-1].map {|table_data| Table.parse table_data } table = tables.select do |_table| _table.name == table end unless table.first.nil? table.first.attributes.map do |attribute| attribute.name.to_sym end end end |