我尝试使用rails-assets-angular
gem将AngularJS引导到Rails引擎中。
但是,当我在父应用程序上启动服务器时(安装了我的引擎的应用程序),我收到此错误:couldn't find file '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
答案 0 :(得分:10)
想出来了!
在 lib / engine_name / engine.rb 中添加require "rails-assets-angular"
。