ruby-on-rails – Rails4:如何提供gem特定的javascript文件?

ruby-on-rails – Rails4:如何提供gem特定的javascript文件?,第1张

概述我将一个工作rails应用程序复制到另一个目录中,并使用重命名Gem重命名它. 大多数rails功能都正常,但我无法提供与gems捆绑的资产,特别是来自bootstrap-slider-rails的js文件 我比较了我的application.rb,Gemfile和application.js,它们在两个应用程序中是相同的. 我已经尝试过再次卸载和安装gem 应用程序之间的简单比较并不能解决问题. 我将一个工作rails应用程序复制到另一个目录中,并使用重命名Gem重命名它.

大多数rails功能都正常,但我无法提供与gems捆绑的资产,特别是来自bootstrap-slIDer-rails的Js文件

我比较了我的application.rb,Gemfile和application.Js,它们在两个应用程序中是相同的.

我已经尝试过再次卸载和安装gem

应用程序之间的简单比较并不能解决问题.

以下是我在两个应用中验证的文件相同:

> Gemfile
> application.rb
> application.HTML.haml
> application.Js

有什么建议我应该如何调试这个?

谢谢!

只是为了向您显示问题,请在Rubymine中比较这2张图片

工作应用:

非工作应用程序:

以下是一些相关文件的外观:

的application.Js

application.rb中

require file.expand_path('../boot',__file__)# Pick the frameworks you want:require "active_record/railtIE"require "action_controller/railtIE"require "action_mailer/railtIE"require "sprockets/railtIE"# require "rails/test_unit/railtIE"#if defined?(Bundler)#  # If you precompile assets before deploying to production,use this line#  #Bundler.require(*Rails.groups(:assets => %w(development test)))#  # If you want your assets lazily compiled in production,use this line#  # Bundler.require(:default,:assets,Rails.env)#end# Rails4Bundler.require(:default,Rails.env)module Smoothlyhired  class Application < Rails::Application    # don't generate RSpec tests for vIEws and helpers    config.generators do |g|      g.test_framework :rspec,fixture: true      g.fixture_replacement :factory_girl,dir: 'spec/factorIEs'      g.vIEw_specs false      g.helper_specs false    end    config.autoload_paths += %W(#{config.root}/lib)    config.enCoding = "utf-8"    # Configure sensitive parameters which will be filtered from the log file.    config.filter_parameters += [:password,:password_confirmation]    config.active_record.schema_format = :sql    # Enable the asset pipeline    config.assets.enabled = true    # Version of your assets,change this if you want to expire all your assets    config.assets.version = '1.0'    #Prevent initializing the application and connecting to db on bootup as required by heroku    #https://devcenter.heroku.com/articles/rails-asset-pipeline    # Not required on rails4 anymore    #config.assets.initialize_on_precompile = false    #config.action_vIEw.JavaScript_expansions[:defaults] = %w(jquery.min jquery_uJs)  endend

的Gemfile

source 'https://rubygems.org'ruby '2.1.0'gem 'rails','4.0.0'gem 'sass-rails','~> 4.0.0'gem 'coffee-rails',git: 'git://github.com/rails/coffee-rails.git'gem 'uglifIEr','>= 1.0.3'gem 'jquery-rails'gem 'jquery-ui-rails'gem 'Font-awesome-sass'gem 'less-rails'gem 'therubyracer',:platform=>:rubygem 'twitter-bootstrap-rails'#gem 'jquery_mobile_rails'gem 'Js-routes'gem 'cancan'gem 'devise'gem 'figaro'gem 'haml-rails'gem 'pg'gem 'rolify'gem 'sendgrID'gem 'simple_form'gem 'thin'gem 'rake'#To use db for storing cookies instead cookie-storegem 'activerecord-session_store',github: 'rails/activerecord-session_store'group :development do  gem 'better_errors'  #gem 'binding_of_caller',:platforms=>[:mri_19,:rbx]  #Commenting out platforms part,because may be that's stopPing this to be used on the dev machine'  gem 'binding_of_caller'  gem 'guard-bundler'  gem 'guard-rails'  gem 'guard-rspec'  gem 'HTML2haml'  gem 'quIEt_assets'  gem 'rb-fchange',:require=>false  gem 'rb-fsevent',:require=>false  gem 'rb-inotify',:require=>false  # required with Rails panel Chrome extension. This Gem should come after better_errors gem  gem 'Meta_request'endgroup :development,:test do  #gem 'factory_girl_rails'  #gem 'rspec-rails'  gem 'pry-byeBUG'  gem 'pry-stack_explorer'  gem 'pry-rails'  gem 'pry-deBUGger'  gem 'deBUGger','>= 1.6.5'endgroup :test do  gem 'capybara'  gem 'database_cleaner'  gem 'email_spec'endgroup :production do  gem 'rails_12factor'endgem 'high_voltage'#linkedin Loginsgem "linkedin"gem "omniauth"gem "omniauth-linkedin"gem "omniauth-facebook"#postgres use hstore in active record#gem 'activerecord-postgres-hstore'gem 'state_machine'gem "ruby-graphviz"#payments#gem 'stripe',:git => 'https://github.com/stripe/stripe-ruby'#gem 'newrelic_rpm'gem 'pgbackups-archive'gem 'pg_search'gem 'acts-as-taggable-on'#gem 'activeadmin',github: 'gregbell/active_admin'gem "activeadmin",git: "https://github.com/gregbell/active_admin"#gem 'kaminari'gem 'bootstrap-slIDer-rails'#gem 'twitter_bootstrap_form_for'#gem 'bootstrap_form'#gem 'formtastic'gem 'formtastic-bootstrap'gem 'rename'
解决方法 尝试删除gemfile.lock并再次运行bundle install.

有关复制和部署rails应用程序的信息,请参阅this SO帖子.如果没有,则应删除.git文件并运行git init.

我不是百分百肯定这会解决你的问题,但我怀疑你有宝石问题.

总结

以上是内存溢出为你收集整理的ruby-on-rails – Rails4:如何提供gem特定的javascript文件?全部内容,希望文章能够帮你解决ruby-on-rails – Rails4:如何提供gem特定的javascript文件?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1269842.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-08
下一篇 2022-06-08

发表评论

登录后才能评论

评论列表(0条)

保存