Class: DohDb::LinkedRow
Class Method Summary collapse
Class Method Details
.build(field, idvalue) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/doh/mysql/virtual.rb', line 8 def self.build(field, idvalue) return ReadOnlyRow.new([], []) if idvalue.to_i == 0 table = field.sub(/_id/, '') table = table.rafter('_') unless DohDb::table_exist?(table) raise "unable to determine child table name for field #{field}" unless DohDb::table_exist?(table) DohDb::select_row("SELECT * FROM #{table} WHERE #{DohDb::find_primary_key(table)} = #{idvalue}", DohDb::find_row_type(table) || :smart) end |