0
我有scaffold
有2場name:string, active:boolean..
將數據插入2和表1個控制器
這樣支架創建數據...
def create
@question = Question.new(params[:question])
render :json => @question.to_ext_json(:success => @question.save)
end
一切都很好,但我想,當產生問題的一些數據插入到我的另一個表稱爲標記:
在我的符號表中只有2場:令牌& IS_ACTIVE(布爾)
def create
@w = "token"
@question = Question.new(params[:question])
@token = Token.new({:token => @w, :is_active=>"1"})
render :json => @question.to_ext_json(:success => @question.save)
end
這種方式不起作用。我怎麼能做到這一點?