Transformational Software Engineering Lead your team into the future with unprecedented visibility. Details
![Blog](https://cdn-ak-scissors.b.st-hatena.com/image/square/b47a94b850347e0f2c3df6222779d9c3e9856707/height=288;version=1;width=512/https%3A%2F%2Fdu10j5vfk4mbr.cloudfront.net%2F_1200x630_crop_center-center_82_none%2Fseo-general-ogimage.png%3Fmtime%3D1684273589)
Rails 3.0.4で複合一意制約を定義する方法は二通りあるようです。 1.ActiveRecordでモデルに一意制約を定義する 2.RDBMSで一意索引を作る 通常は両方実装するものと思われます。 次のようなモデルで確認します。 class CreateMultiples < ActiveRecord::Migration def self.up create_table :multiples do |t| t.string :key1 t.string :key2 t.string :key3 t.string :value t.timestamps end end def self.down drop_table :multiples end end まず1.の場合ですが、Stack Overflowにありました。 In Rails 2, I would have written:
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く