CaiDeHen 发表于 2013-1-29 07:45:25

#58 How to Make a Generator

Rails comes with many built-in generators, but what if you want to customize them or make your own? Rails gives you a great way to do this which you will learn in this episode.
# app_layout_generator.rb class AppLayoutGenerator < Rails::Generator::NamedBasedef manifest    record do |m|      m.template "layout.rhtml",   "app/views/layouts/#{file_name}.rhtml"      m.file   "stylesheet.css", "public/stylesheets/#{file_name}.css"    endendend
页: [1]
查看完整版本: #58 How to Make a Generator