2011-12-08 15 views
10

मुझे कई रेल 3.1 ऐप्स मिल गए हैं, और मुझे इन सभी में यह समस्या है।जेएस फाइलें रेल ऐप में दोहरी शामिल हैं

मैं js फ़ाइलों कि मेरी application.js फ़ाइल में शामिल हो का एक समूह है। यहाँ मेरी application.js है:

//= require jquery 
//= require jquery-ui 
//= require jquery_ujs 
//= require_self 
//= require_tree . 

समस्या यह है कि, सही पर सेट मेरी जावास्क्रिप्ट फ़ाइलों के सभी डबल शामिल शीर्षक में मिलता है जब, development.rb, मैं config.assets.debug है। असल में, वे स्पष्ट रूप से डबल-शामिल नहीं हैं, बल्कि उन्हें संकलित अनुप्रयोग.जेएस फ़ाइल के हिस्से के रूप में व्यक्तिगत रूप से एक बार और एक बार शामिल किया जाता है। जेएस में टैग इस तरह दिखते हैं:

<script src="/assets/jquery.js?body=1" type="text/javascript"></script> 
<script src="/assets/jquery-ui.js?body=1" type="text/javascript"></script> 
<script src="/assets/jquery_ujs.js?body=1" type="text/javascript"></script> 
<script src="/assets/application.js?body=1" type="text/javascript"></script> 
<script src="/assets/animation_elements.js?body=1" type="text/javascript"></script> 
<script src="/assets/categories.js?body=1" type="text/javascript"></script> 
<script src="/assets/facebox.js?body=1" type="text/javascript"></script> 
… 

तो क्या है? इसका नतीजा यह है कि विभिन्न JQuery ऑनक्लिक() व्यवहार दो बार और अन्य बकवास किया जा रहा है। यहाँ क्या समस्या है?

Geobooks::Application.configure do 
    # Settings specified here will take precedence over those in config/application.rb 

    # In the development environment your application's code is reloaded on 
    # every request. This slows down response time but is perfect for development 
    # since you don't have to restart the webserver when you make code changes. 
    config.cache_classes = false 

    # Log error messages when you accidentally call methods on nil. 
    config.whiny_nils = true 

    # Show full error reports and disable caching 
    config.consider_all_requests_local  = true 
    #config.action_view.debug_rjs    = true 
    config.action_controller.perform_caching = false 

    # Don't care if the mailer can't send 
    config.action_mailer.raise_delivery_errors = false 

    # Print deprecation notices to the Rails logger 
    config.active_support.deprecation = :log 

    # Only use best-standards-support built into browsers 
    config.action_dispatch.best_standards_support = :builtin 

    #for devise 
    config.action_mailer.default_url_options = { :host => 'localhost:3000' } 

    # Do not compress assets 
    config.assets.compress = false 

    # Expands the lines which load the assets 
    config.assets.debug = false 
end 

उत्तर

14

ऐसा लगता है जैसे कि आप कुछ बिंदु पर अपनी संपत्ति precompiled हो सकता है: रिकॉर्ड के लिए, यहाँ मेरा पूरा development.rb फ़ाइल है। विकास में सेवा की जा रही application.js फ़ाइल की सामग्री की जांच करें। मेरा अनुमान है कि आप अपनी सभी आवश्यक फाइलों की बंडल सामग्री देखेंगे। इसे ठीक करने के लिए, बस /public/assets/javascripts/application.js हटाएं और अपने सर्वर को उछाल दें।

कि, काम नहीं करता है यह पता लगाने की जहां दूसरी प्रतिलिपि (सर्व की गई फाइलें जांच करने के लिए Firebug का उपयोग कर या समान) और एक अपडेट पोस्ट से आ रहा है और मैं मैं क्या कर सकता देखेंगे।

+1

आप बिल्कुल सही है कि जे एस फ़ाइलें application.js फ़ाइल में संकलित कर रहे हैं कर रहे हैं, लेकिन मैं पहले से ही जानता था। मैं अपने ऐप को उसकेोकू में धक्का देने से पहले अपनी संपत्ति का प्रीकंपाइल करता हूं। लगता है जैसे मुझे अपनी प्रीकंपील्ड संपत्तियों को हटाना चाहिए, git manifest.yml को अनदेखा करें, और उसेोकू को प्रीकंपलिंग को संभालने दें। मैं कोशिश करूँगा। – CharlieMezak

+0

@CharlieMezak ने यह काम किया? –

संबंधित मुद्दे