1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Add a form hook to erb scaffold. Customize and go!

This commit is contained in:
José Valim 2009-07-15 22:43:25 +02:00
parent 8d47078a49
commit bcf754d8c4
2 changed files with 9 additions and 2 deletions

View file

@ -45,6 +45,7 @@ module Rails
},
:erb => {
:form => false,
:layout => true
},

View file

@ -7,8 +7,9 @@ module Erb
argument :attributes, :type => :hash, :default => {}, :banner => "field:type field:type"
class_option :singleton, :type => :boolean, :desc => "Supply to skip index action"
class_option :layout, :type => :boolean
class_option :form, :type => :boolean
class_option :layout, :type => :boolean
class_option :singleton, :type => :boolean, :desc => "Supply to skip index view"
def create_root_folder
empty_directory File.join("app/views", controller_file_path)
@ -31,6 +32,11 @@ module Erb
copy_view :new
end
def copy_form_file
return unless options[:form]
copy_view :_form
end
def copy_layout_file
return unless options[:layout]
template "layout.html.erb",