Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 30 lines (23 sloc) 0.729 kB
b61f6f5 @josevalim Load generators from both lib/rails/generators and lib/generators. Us…
josevalim authored
1 require 'rails/generators/erb'
f0dd77c Move railties/lib/* into railties/lib/*
Yehuda Katz + Carl Lerche authored
2 require 'rails/generators/resource_helpers'
80cd163 @josevalim Added scaffold views to scaffold controller.
josevalim authored
3
4 module Erb
5 module Generators
6 class ScaffoldGenerator < Base
0efedf2 @josevalim Ensure scaffold works properly even if plural name is given. [#3062]
josevalim authored
7 include Rails::Generators::ResourceHelpers
80cd163 @josevalim Added scaffold views to scaffold controller.
josevalim authored
8
10fd021 @josevalim Change attributes default type to array to allow order to be preserved.
josevalim authored
9 argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
1a4d8ac @josevalim Added tests to scaffold controller.
josevalim authored
10
c972b25 @josevalim Tests for scaffold generator.
josevalim authored
11 def create_root_folder
12 empty_directory File.join("app/views", controller_file_path)
13 end
14
8b50f89 @josevalim Make ERB generators more flexible and customizable.
josevalim authored
15 def copy_view_files
67ee6c3 @sikachu Remove the --singeleton option from scaffold generator.
sikachu authored
16 available_views.each do |view|
8b50f89 @josevalim Make ERB generators more flexible and customizable.
josevalim authored
17 filename = filename_with_extensions(view)
18 template filename, File.join("app/views", controller_file_path, filename)
19 end
bcf754d @josevalim Add a form hook to erb scaffold. Customize and go!
josevalim authored
20 end
21
8b50f89 @josevalim Make ERB generators more flexible and customizable.
josevalim authored
22 protected
80cd163 @josevalim Added scaffold views to scaffold controller.
josevalim authored
23
8b50f89 @josevalim Make ERB generators more flexible and customizable.
josevalim authored
24 def available_views
25 %w(index edit show new _form)
26 end
80cd163 @josevalim Added scaffold views to scaffold controller.
josevalim authored
27 end
28 end
29 end
Something went wrong with that request. Please try again.