diff options
author | José Valim <jose.valim@gmail.com> | 2009-07-15 22:43:25 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2009-07-15 22:43:25 +0200 |
commit | bcf754d8c471187da386e147707598e5c8e52090 (patch) | |
tree | 4e1d231153e5e851d94a17cdee838d73a49b4233 /railties | |
parent | 8d47078a492de9e3fca61ec6894e975d570ef449 (diff) | |
download | rails-bcf754d8c471187da386e147707598e5c8e52090.tar.gz rails-bcf754d8c471187da386e147707598e5c8e52090.tar.bz2 rails-bcf754d8c471187da386e147707598e5c8e52090.zip |
Add a form hook to erb scaffold. Customize and go!
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/generators.rb | 1 | ||||
-rw-r--r-- | railties/lib/generators/erb/scaffold/scaffold_generator.rb | 10 |
2 files changed, 9 insertions, 2 deletions
diff --git a/railties/lib/generators.rb b/railties/lib/generators.rb index 3286e8b2dd..c59bb9776f 100644 --- a/railties/lib/generators.rb +++ b/railties/lib/generators.rb @@ -45,6 +45,7 @@ module Rails }, :erb => { + :form => false, :layout => true }, diff --git a/railties/lib/generators/erb/scaffold/scaffold_generator.rb b/railties/lib/generators/erb/scaffold/scaffold_generator.rb index 1841124ae4..946c5a0abc 100644 --- a/railties/lib/generators/erb/scaffold/scaffold_generator.rb +++ b/railties/lib/generators/erb/scaffold/scaffold_generator.rb @@ -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", |