我创建了一个 Rails 引擎(根据Rails Guides),使用:
rails plugin new address_book --full --mountable
然后我继续按照这个问题的答案中的说明,尝试了“haml”gem和“haml-rails”gem(我想要后者,因为我也在我的父应用程序中使用它)。
由于某种原因,运行后bundle
,然后
rails g controller pages temp
它仍然创建 .erb 文件而不是 .haml 文件。
任何援助将不胜感激。我的代码如下:
'lib/address_book.rb' 文件:
require "address_book/engine"
require "haml-rails"
module AddressBook
end
'address_book.gemspec' 文件:
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "address_book/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "address_book"
s.version = AddressBook::VERSION
s.authors = ["TODO: Your name"]
s.email = ["TODO: Your email"]
s.homepage = "TODO"
s.summary = "TODO: Summary of AddressBook."
s.description = "TODO: Description of AddressBook."
s.files = Dir["{app,config,db,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.md"]
s.test_files = Dir["test/**/*"]
s.add_dependency "rails", "~> 3.2.5"
s.add_dependency "haml-rails"
# s.add_dependency "jquery-rails"
s.add_development_dependency "sqlite3"
end
“宝石文件”文件:
source "http://rubygems.org"
gemspec
gem "jquery-rails"