Có cách nào để định cấu hình đường ray để sử dụng haml theo mặc định hay không, tức là khi một giàn giáo được tạo theo scaffold_name/index.html.haml
được tạo thay vì scaffold_name/index.html.erb
.haml theo mặc định
Tương tự như cách bạn có thể thêm config.sass.preferred_syntax = :sass
vào config/application.rb
và có scaffold_name.sass
được tạo theo mặc định.
Cố gắng thêm dòng sau vào config/application.rb
config.generators do |g|
g.template_engine :haml
end
nhưng dọa lên với những điều sau
$ rails generate scaffold foo name:string
invoke active_record
create db/migrate/20120208152550_create_foos.rb
create app/models/foo.rb
invoke test_unit
create test/unit/foo_test.rb
create test/fixtures/foos.yml
route resources :foos
invoke scaffold_controller
create app/controllers/foos_controller.rb
error haml [not found]
invoke test_unit
create test/functional/foos_controller_test.rb
invoke helper
create app/helpers/foos_helper.rb
invoke test_unit
create test/unit/helpers/foos_helper_test.rb
invoke assets
invoke coffee
create app/assets/javascripts/foos.js.coffee
invoke sass
create app/assets/stylesheets/foos.css.sass
invoke sass
identical app/assets/stylesheets/scaffolds.css.sass
$ rails destroy scaffold foo
invoke active_record
remove db/migrate/20120208152550_create_foos.rb
remove app/models/foo.rb
invoke test_unit
remove test/unit/foo_test.rb
remove test/fixtures/foos.yml
route resources :foos
invoke scaffold_controller
remove app/controllers/foos_controller.rb
error haml [not found]
invoke test_unit
remove test/functional/foos_controller_test.rb
invoke helper
remove app/helpers/foos_helper.rb
invoke test_unit
remove test/unit/helpers/foos_helper_test.rb
invoke assets
invoke coffee
remove app/assets/javascripts/foos.js.coffee
invoke sass
remove app/assets/stylesheets/foos.css.sass
invoke sass
Tôi tạo ra một tốt đẹp chút bó lệnh để thay thế tất cả ERB với các tập tin Haml sau this thu hình màn ảnh nhưng tôi m vẫn quan tâm đến việc làm cho nó mặc định khi giàn giáo được tạo ra! Làm thế nào để làm cho nó để các tập tin haml (không erb!) Được tạo ra theo mặc định?
Đây là đường ray. Chào mừng lên tàu. – Green