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
这种方式不起作用。我怎么能做到这一点?