Method: Og::SqlStore#drop_table

Defined in:
lib/og/store/sql.rb

#drop_table(klass) ⇒ Object Also known as: destroy

Drop the sql table where objects of this class are persisted.



408
409
410
411
412
413
414
415
416
417
# File 'lib/og/store/sql.rb', line 408

def drop_table(klass)
  # Remove leftover data from some join tabkes.
  klass.relations.each do |rel|
    if rel.class.to_s == "Og::JoinsMany" and rel.join_table
      target_class =  rel.target_class
      exec "DELETE FROM #{rel.join_table}"
    end
  end
  exec "DROP TABLE #{klass.table}"
end