2007-09-02から1日間の記事一覧

ActiveRecord has_many メモ2

じゃぁっていうわけで class Reservation < ActiveRecord::Base has_many :units , :dependent => false endとかしたら r.destroy Unit.find(1).reservation_id => 1 Unit.find(2).reservation_id => 1だが r.units.delete(u1) u1.reservation.id => nilって…

ActiveRecord has_many メモ3

だから r.units.clear r.destroyこうします。

ActiveRecord has_many メモ

create_table :reservations, :force => "true" do |t| t.column "name", :string r.column "lock_versioin", :integer end create_table :units, :force => "true" do |t| t.column "name", :string t.column "reservation_id", :integer r.column "lock_ve…