ruby-on-rails – 在可安装的Rails引擎中使用rails-assets-angular gem

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 在可安装的Rails引擎中使用rails-assets-angular gem前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用rails-assets-angular gem将AngularJS引导到Rails引擎中.

但是,当我在父应用程序(我的引擎安装的应用程序)上启动服务器时,我收到此错误:找不到文件’angular’.

这是我的application.js:

//= require angular
//= require_tree .

这是我的.gemspec:

$:.push File.expand_path("../lib",__FILE__)

# Maintain your gem's version:
require "lesson_notes/version"

# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
  s.name        = "lesson_notes"
  s.version     = LessonNotes::VERSION

  s.files = Dir["{app,config,db,lib}/**/*","MIT-LICENSE","Rakefile","README.rdoc"]

  s.add_dependency "rails","~> 4.0.4"
  s.add_dependency "rails-assets-angular"

  s.add_development_dependency "pg"

  s.add_development_dependency "rspec","~> 2.14.1"
  s.add_development_dependency "rspec-rails"
  s.add_development_dependency "capybara","~> 2.2.1"
  s.add_development_dependency "factory_girl_rails","~> 4.0"
  s.add_development_dependency "rails-assets-angular-mocks"
  s.add_development_dependency "database_cleaner","~> 1.2.0"

  s.test_files = Dir["spec/**/*"]
end

我的Gemfile:

source "https://rubygems.org"
source "https://rails-assets.org"

gemspec

解决方法

弄清楚了!

在lib / engine_name / engine.rb中,添加require“rails-assets-angular”.

原文链接:https://www.f2er.com/ruby/270427.html

猜你在找的Ruby相关文章