#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

你可能感兴趣的:(css,Rails)