升级Rails环境

时间:2015-12-04 08:22:25

标签: ruby-on-rails

我正在升级rails环境并尝试更新字段  但是page.replace_html无法正常工作我正在使用像

这样的更新方法
$(document).ready(function() {

    if ($('.nav-tabs').length > 0) { // if .nav-tabs exists
        var hashtag = window.location.hash;
        if (hashtag!='') {
            $('.nav-tabs > li').removeClass('active');
            $('.nav-tabs > li > a[href="'+hashtag+'"]').parent('li').addClass('active');
            $('.tab-content > div').removeClass('active');
            $(hashtag).addClass('active');
        }
    }

});

但我得到的错误就像 -

using (var scope = new TransactionScope(TransactionScopeOption.Required)) 
{ 
    using (var context = new DbContext()) 
    { 
        //first I want to update an item in the context, not to the db
        Item thisItem = context.Items.First();
        thisItem.Name = "Update name";
        context.SaveChanges(); //Save change to this context

        //then I want to do a query on the updated item on the current context, not against the db
        Item thisUpdatedItem = context.Items.Where(a=>a.Name == "Update name").First();

        //do some more query
    } 

    //First here I want it to commit all the changes in the current context to the db
    scope.Complete(); 
} 

有人可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题 -

我已创建第一个update.js.haml并编写代码 -

jQuery('#test').html('#{ j render :partial => 'edit', :locals => {:type => @type, :cate => @cat}}');

添加名为test.js.coffee的另一个文件assests / javascript / ujs文件夹。

相关问题