【问题标题】:javascript overriding not working in productionjavascript覆盖在生产中不起作用
【发布时间】:2013-08-16 10:33:22
【问题描述】:

在我的应用程序中,我想覆盖 gem 中已有的 js 文件。现在的问题是我能够在开发中覆盖它并且它也可以正常工作

但在生产中,它从 gem 调用 js 文件而不是我的应用程序 我的应用

if (city!='' && state!='') {
    $('#Location').val(city+', '+state).removeClass('defaultTextActive');
}

宝石

if (city!='' && state!=''&& pin!='') {
    $('#Location').val(city+', '+state+','+pin).removeClass('defaultTextActive');
}

【问题讨论】:

    标签: javascript ruby-on-rails ajax


    【解决方案1】:

    试试这个

    清除所有预编译资产,并使用以下 rake 任务重新生成它们。

      rake assets:clean
      rake assets:precompile RAILS_ENV=production
    

    【讨论】:

    • 嗨,我在尝试 rake assets 时遇到以下错误:clean /home/swagata/.rvm/rubies/ruby-1.9.3-p448/bin/ruby /home/swagata/.rvm/gems/ ruby-1.9.3-p448@global/bin/rake assets:clean:all RAILS_ENV=production RAILS_GROUPS=assets 我尝试安装 gem install activerecord-postrgesql-adapter 出现错误,如 ERROR: Could not find a valid gem 'activerecord-postrgesql -adapter' (>= 0) 在任何存储库 rake 中止!请安装postegresql适配器:gem install activerecord-postegresql-adapter(无法加载此类文件--active_record/connection_adapters/postegresql_adapter)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多