比如一个model是join table,并且有些自己的属性。
[code="rails"]
class CreateFriendsEducations < ActiveRecord::Migration
def self.up
create_table :friends_educations, :id => false do |t|
t.integer :friend_id, :null => false
t.integer :school_id, :null => false
t.string :major_in
t.string :minor_in
t.timestamps
end
end
def self.down
drop_table :friends_educations
end
end
[/code]
要删除该table中某一项怎么删呢。。
我用
[code="rails"]FriendsEducation.destroy_all("some_conditions")[/code]
[code="rails"]
@edu = FriendsEducation.find("some_conditions")
@edu.destroy
[/code]
数据库都没反应。。。log显示
[4;35;1mFriendsEducation Destroy (0.0ms)[0m [0mDELETE FROM "friends_educations" WHERE "id" = NULL [0m