Displaying 2 results from an estimated 2 matches for "dst_id".
Did you mean:
dst_ip
2012 Mar 22
6
rescuing ActiveRecord::RecordNotUnique: clever or ugly?
...e foreign
keys act as a single compound key that needs to be unique:
class CreateRelations < ActiveRecord::Migration
def change
create_table :relations do |t|
t.references :src, :null => false
t.references :dst, :null => false
end
add_index :relations, [:src_id, :dst_id], :unique => true
end
end
One obvious way to enforce uniqueness would be using first_or_create:
def self.create_relation(src, dst)
where(:src_id => src.id, :dst_id => dst.id).first_or_create!
end
Which works, but that always does a SELECT before creating the record.
Since I don'...
2007 Apr 13
2
R on Solaris 10 x64
...x8966770, iter =
0x8045980, nelmts = 3120U, dxpl_cache = 0xfe170078, _tgath_buf =
0x9f5c4f0), line 379 in "H5Dselect.c"
[3] H5D_contig_write(io_info = 0x804620c, nelmts = 3120ULL, mem_type =
0x97b05c8, mem_space = 0x8966770, file_space = 0x8966770, tpath =
0x8ee7078, src_id = 201326906, dst_id = 201326904, buf = 0x9f79580),
line 1418 in "H5Dio.c"
[4] H5D_write(dataset = 0x8f169c0, mem_type_id = 201326906, mem_space
= 0x8966770, file_space = 0x8966770, dxpl_id = 671088643, buf =
0x9f79580), line 952 in "H5Dio.c"
[5] H5Dwrite(dset_id = 335544330, mem_type_id = 20132...