diff options
Diffstat (limited to 'railties/lib/rails/generators/erb/controller')
-rw-r--r-- | railties/lib/rails/generators/erb/controller/controller_generator.rb | 20 | ||||
-rw-r--r-- | railties/lib/rails/generators/erb/controller/templates/view.html.erb | 2 |
2 files changed, 22 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/erb/controller/controller_generator.rb b/railties/lib/rails/generators/erb/controller/controller_generator.rb new file mode 100644 index 0000000000..ac57140c23 --- /dev/null +++ b/railties/lib/rails/generators/erb/controller/controller_generator.rb @@ -0,0 +1,20 @@ +require 'rails/generators/erb' + +module Erb + module Generators + class ControllerGenerator < Base + argument :actions, :type => :array, :default => [], :banner => "action action" + + def copy_view_files + base_path = File.join("app/views", class_path, file_name) + empty_directory base_path + + actions.each do |action| + @action = action + @path = File.join(base_path, filename_with_extensions(action)) + template filename_with_extensions(:view), @path + end + end + end + end +end diff --git a/railties/lib/rails/generators/erb/controller/templates/view.html.erb b/railties/lib/rails/generators/erb/controller/templates/view.html.erb new file mode 100644 index 0000000000..cd54d13d83 --- /dev/null +++ b/railties/lib/rails/generators/erb/controller/templates/view.html.erb @@ -0,0 +1,2 @@ +<h1><%= class_name %>#<%= @action %></h1> +<p>Find me in <%= @path %></p> |