0
我只能在查詢的幫助下將所有保存在「第一個」表中的數據傳遞給「first_archives」表。我在'destroy'下使用「first」控制器中的查詢,以便從「first」中選擇id並插入到歸檔表中。 代碼如下:帶導軌的MySQL
class FirstsController < ApplicationController
def destroy
@first = First.find(params[:id])
if @first.destroy
cd = First_archive.new :first_id =>"First.find :all, :conditions => { :id => @id }"
cd.save
respond_to do |format|
format.html { redirect_to(firsts_url) }
format.xml { head :ok }
end
end
請幫助疑惑兩兩件事:
*所使用的語法是正確的。
*我們必須寫在first_archive表中。
謝謝