Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using rails-assets-angular gem in mountable Rails engine

I'm trying to bootstrap AngularJS into a Rails engine using the rails-assets-angular gem.

However, when I start the server on the parent app (the app my engine is mounted in), I get this error: couldn't find file 'angular'.


Here's my application.js:

//= require angular
//= require_tree .

Here's my .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 

And my Gemfile:

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

gemspec
like image 485
niftygrifty Avatar asked Apr 21 '14 05:04

niftygrifty


1 Answers

Figured it out!

In lib/engine_name/engine.rb add require "rails-assets-angular".

like image 194
niftygrifty Avatar answered Oct 02 '22 14:10

niftygrifty