`
CaiDeHen
  • 浏览: 96133 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

#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::NamedBase
  def manifest
    record do |m|
      m.template "layout.rhtml",   "app/views/layouts/#{file_name}.rhtml"
      m.file     "stylesheet.css", "public/stylesheets/#{file_name}.css"
    end
  end
end
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics