bpokosh-nifty-generators 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. data/CHANGELOG +19 -0
  2. data/LICENSE +20 -0
  3. data/Manifest +57 -0
  4. data/README +73 -0
  5. data/TODO +6 -0
  6. data/lib/nifty_generators.rb +3 -0
  7. data/nifty-generators.gemspec +51 -0
  8. data/rails_generators/nifty_config/USAGE +23 -0
  9. data/rails_generators/nifty_config/nifty_config_generator.rb +32 -0
  10. data/rails_generators/nifty_config/templates/config.yml +8 -0
  11. data/rails_generators/nifty_config/templates/load_config.rb +2 -0
  12. data/rails_generators/nifty_layout/USAGE +25 -0
  13. data/rails_generators/nifty_layout/nifty_layout_generator.rb +31 -0
  14. data/rails_generators/nifty_layout/templates/helper.rb +23 -0
  15. data/rails_generators/nifty_scaffold/USAGE +51 -0
  16. data/rails_generators/nifty_scaffold/nifty_scaffold_generator.rb +205 -0
  17. data/rails_generators/nifty_scaffold/templates/action_specs/create.rb +11 -0
  18. data/rails_generators/nifty_scaffold/templates/action_specs/destroy.rb +6 -0
  19. data/rails_generators/nifty_scaffold/templates/action_specs/edit.rb +4 -0
  20. data/rails_generators/nifty_scaffold/templates/action_specs/index.rb +4 -0
  21. data/rails_generators/nifty_scaffold/templates/action_specs/new.rb +4 -0
  22. data/rails_generators/nifty_scaffold/templates/action_specs/show.rb +4 -0
  23. data/rails_generators/nifty_scaffold/templates/action_specs/update.rb +11 -0
  24. data/rails_generators/nifty_scaffold/templates/action_tests/create.rb +11 -0
  25. data/rails_generators/nifty_scaffold/templates/action_tests/destroy.rb +6 -0
  26. data/rails_generators/nifty_scaffold/templates/action_tests/edit.rb +4 -0
  27. data/rails_generators/nifty_scaffold/templates/action_tests/index.rb +4 -0
  28. data/rails_generators/nifty_scaffold/templates/action_tests/new.rb +4 -0
  29. data/rails_generators/nifty_scaffold/templates/action_tests/show.rb +4 -0
  30. data/rails_generators/nifty_scaffold/templates/action_tests/update.rb +11 -0
  31. data/rails_generators/nifty_scaffold/templates/actions/create.rb +9 -0
  32. data/rails_generators/nifty_scaffold/templates/actions/destroy.rb +6 -0
  33. data/rails_generators/nifty_scaffold/templates/actions/edit.rb +3 -0
  34. data/rails_generators/nifty_scaffold/templates/actions/index.rb +3 -0
  35. data/rails_generators/nifty_scaffold/templates/actions/new.rb +3 -0
  36. data/rails_generators/nifty_scaffold/templates/actions/show.rb +3 -0
  37. data/rails_generators/nifty_scaffold/templates/actions/update.rb +9 -0
  38. data/rails_generators/nifty_scaffold/templates/controller.rb +14 -0
  39. data/rails_generators/nifty_scaffold/templates/controller_spec.rb +8 -0
  40. data/rails_generators/nifty_scaffold/templates/controller_test.rb +5 -0
  41. data/rails_generators/nifty_scaffold/templates/fixtures.yml +9 -0
  42. data/rails_generators/nifty_scaffold/templates/helper.rb +2 -0
  43. data/rails_generators/nifty_scaffold/templates/migration.rb +16 -0
  44. data/rails_generators/nifty_scaffold/templates/model.rb +2 -0
  45. data/rails_generators/nifty_scaffold/templates/model_spec.rb +11 -0
  46. data/rails_generators/nifty_scaffold/templates/model_test.rb +8 -0
  47. data/tasks/deployment.rake +2 -0
  48. data/test/test_helper.rb +117 -0
  49. data/test/test_nifty_config_generator.rb +37 -0
  50. data/test/test_nifty_layout_generator.rb +36 -0
  51. data/test/test_nifty_scaffold_generator.rb +490 -0
  52. metadata +123 -0
data/CHANGELOG ADDED
@@ -0,0 +1,19 @@
1
+ *0.1.3* (June 20th, 2008)
2
+
3
+ * using _url in controllers instead of _path
4
+
5
+ * improving the nifty_config default example YAML file
6
+
7
+ *0.1.2* (May 16th, 2008)
8
+
9
+ * mentioning nifty_layout in nifty_scaffold generator
10
+
11
+ * adding nifty_config generator
12
+
13
+ *0.1.1* (May 9th, 2008)
14
+
15
+ * adding tests and specs to scaffold generator
16
+
17
+ *0.1.0* (May 8th, 2008)
18
+
19
+ * initial release
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Ryan Bates
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest ADDED
@@ -0,0 +1,57 @@
1
+ CHANGELOG
2
+ lib/nifty_generators.rb
3
+ LICENSE
4
+ Manifest
5
+ rails_generators/nifty_config/nifty_config_generator.rb
6
+ rails_generators/nifty_config/templates/config.yml
7
+ rails_generators/nifty_config/templates/load_config.rb
8
+ rails_generators/nifty_config/USAGE
9
+ rails_generators/nifty_layout/nifty_layout_generator.rb
10
+ rails_generators/nifty_layout/templates/helper.rb
11
+ rails_generators/nifty_layout/templates/layout.html.erb
12
+ rails_generators/nifty_layout/templates/stylesheet.css
13
+ rails_generators/nifty_layout/USAGE
14
+ rails_generators/nifty_scaffold/nifty_scaffold_generator.rb
15
+ rails_generators/nifty_scaffold/templates/action_specs/create.rb
16
+ rails_generators/nifty_scaffold/templates/action_specs/destroy.rb
17
+ rails_generators/nifty_scaffold/templates/action_specs/edit.rb
18
+ rails_generators/nifty_scaffold/templates/action_specs/index.rb
19
+ rails_generators/nifty_scaffold/templates/action_specs/new.rb
20
+ rails_generators/nifty_scaffold/templates/action_specs/show.rb
21
+ rails_generators/nifty_scaffold/templates/action_specs/update.rb
22
+ rails_generators/nifty_scaffold/templates/action_tests/create.rb
23
+ rails_generators/nifty_scaffold/templates/action_tests/destroy.rb
24
+ rails_generators/nifty_scaffold/templates/action_tests/edit.rb
25
+ rails_generators/nifty_scaffold/templates/action_tests/index.rb
26
+ rails_generators/nifty_scaffold/templates/action_tests/new.rb
27
+ rails_generators/nifty_scaffold/templates/action_tests/show.rb
28
+ rails_generators/nifty_scaffold/templates/action_tests/update.rb
29
+ rails_generators/nifty_scaffold/templates/actions/create.rb
30
+ rails_generators/nifty_scaffold/templates/actions/destroy.rb
31
+ rails_generators/nifty_scaffold/templates/actions/edit.rb
32
+ rails_generators/nifty_scaffold/templates/actions/index.rb
33
+ rails_generators/nifty_scaffold/templates/actions/new.rb
34
+ rails_generators/nifty_scaffold/templates/actions/show.rb
35
+ rails_generators/nifty_scaffold/templates/actions/update.rb
36
+ rails_generators/nifty_scaffold/templates/controller.rb
37
+ rails_generators/nifty_scaffold/templates/controller_spec.rb
38
+ rails_generators/nifty_scaffold/templates/controller_test.rb
39
+ rails_generators/nifty_scaffold/templates/fixtures.yml
40
+ rails_generators/nifty_scaffold/templates/helper.rb
41
+ rails_generators/nifty_scaffold/templates/migration.rb
42
+ rails_generators/nifty_scaffold/templates/model.rb
43
+ rails_generators/nifty_scaffold/templates/model_spec.rb
44
+ rails_generators/nifty_scaffold/templates/model_test.rb
45
+ rails_generators/nifty_scaffold/templates/views/_form.html.erb
46
+ rails_generators/nifty_scaffold/templates/views/edit.html.erb
47
+ rails_generators/nifty_scaffold/templates/views/index.html.erb
48
+ rails_generators/nifty_scaffold/templates/views/new.html.erb
49
+ rails_generators/nifty_scaffold/templates/views/show.html.erb
50
+ rails_generators/nifty_scaffold/USAGE
51
+ README
52
+ tasks/deployment.rake
53
+ test/test_helper.rb
54
+ test/test_nifty_config_generator.rb
55
+ test/test_nifty_layout_generator.rb
56
+ test/test_nifty_scaffold_generator.rb
57
+ TODO
data/README ADDED
@@ -0,0 +1,73 @@
1
+ = Nifty Generators
2
+
3
+ A collection of useful Rails generator scripts by Ryan Bates.
4
+
5
+ This fork converts the views from ERb to HAML.
6
+
7
+
8
+ == Install
9
+
10
+ gem install ryanb-nifty-generators --source=http://gems.github.com
11
+
12
+
13
+ == Usage
14
+
15
+ Once you install the gem, the generators will be available to all Rails
16
+ applications on your system. If you run script/generate without any
17
+ additional arguments you should see the available generators listed.
18
+
19
+ To run the generator, go to your rails project directory and call it
20
+ using the script/generate or script/destroy command.
21
+
22
+ script/generate nifty_scaffold Recipe name:string index new
23
+
24
+
25
+ == Included Generators
26
+
27
+ * nifty_layout: generates generic layout, stylesheet, and helper files.
28
+ * nifty_scaffold: generates a controller and optional model/migration.
29
+ * nifty_config: generates a config YAML file and loader.
30
+
31
+ Run the command with the --help option to learn more.
32
+
33
+ script/generate nifty_layout --help
34
+
35
+
36
+ == Troubleshooting
37
+
38
+ *I get "undefined method 'title'" error for nifty_scaffold.*
39
+
40
+ Try running nifty_layout too, that will generate this helper method. Or
41
+ you can just change the templates to whatever approach you prefer for
42
+ setting the title.
43
+
44
+
45
+ *Forms don't work for nifty_scaffold.*
46
+
47
+ Try restarting your development server. Sometimes it doesn't detect the
48
+ change in the routing.
49
+
50
+
51
+ *The tests/specs don't work for nifty_scaffold.*
52
+
53
+ Make sure you have mocha installed and require it in your spec/test helper.
54
+
55
+ gem install mocha
56
+
57
+ # in spec_helper.rb
58
+ config.mock_with :mocha
59
+
60
+ # in test_helper.rb
61
+ require 'mocha'
62
+
63
+ Also, make sure you're using edge rails (or 2.1 when released) as some methods require that.
64
+
65
+
66
+ == Development
67
+
68
+ This project can be found on github at the following URL.
69
+
70
+ http://github.com/ryanb/nifty-generators/
71
+
72
+ If you wish the generators behaved differently, please consider
73
+ forking the project and modifying to your heart's content.
data/TODO ADDED
@@ -0,0 +1,6 @@
1
+
2
+ Nifty Scaffold Generator
3
+ - add some validation for attributes/action names
4
+
5
+ Nifty Config Generator
6
+ - make it easier to specify non environment specific configs
@@ -0,0 +1,3 @@
1
+ module NiftyGenerators
2
+ # nothing to see here, the real action is under rails_generators
3
+ end
@@ -0,0 +1,51 @@
1
+
2
+ # Gem::Specification for Nifty-generators-0.1.3
3
+ # Originally generated by Echoe
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = %q{nifty-generators}
7
+ s.version = "0.1.3"
8
+
9
+ s.specification_version = 2 if s.respond_to? :specification_version=
10
+
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.authors = ["Ryan Bates"]
13
+ s.date = %q{2008-06-20}
14
+ s.description = %q{A collection of useful generator scripts for Rails.}
15
+ s.email = %q{ryan (at) railscasts (dot) com}
16
+ s.extra_rdoc_files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "README", "tasks/deployment.rake", "TODO"]
17
+ s.files = ["CHANGELOG", "lib/nifty_generators.rb", "LICENSE", "Manifest", "rails_generators/nifty_config/nifty_config_generator.rb", "rails_generators/nifty_config/templates/config.yml", "rails_generators/nifty_config/templates/load_config.rb", "rails_generators/nifty_config/USAGE", "rails_generators/nifty_layout/nifty_layout_generator.rb", "rails_generators/nifty_layout/templates/helper.rb", "rails_generators/nifty_layout/templates/layout.html.erb", "rails_generators/nifty_layout/templates/stylesheet.css", "rails_generators/nifty_layout/USAGE", "rails_generators/nifty_scaffold/nifty_scaffold_generator.rb", "rails_generators/nifty_scaffold/templates/action_specs/create.rb", "rails_generators/nifty_scaffold/templates/action_specs/destroy.rb", "rails_generators/nifty_scaffold/templates/action_specs/edit.rb", "rails_generators/nifty_scaffold/templates/action_specs/index.rb", "rails_generators/nifty_scaffold/templates/action_specs/new.rb", "rails_generators/nifty_scaffold/templates/action_specs/show.rb", "rails_generators/nifty_scaffold/templates/action_specs/update.rb", "rails_generators/nifty_scaffold/templates/action_tests/create.rb", "rails_generators/nifty_scaffold/templates/action_tests/destroy.rb", "rails_generators/nifty_scaffold/templates/action_tests/edit.rb", "rails_generators/nifty_scaffold/templates/action_tests/index.rb", "rails_generators/nifty_scaffold/templates/action_tests/new.rb", "rails_generators/nifty_scaffold/templates/action_tests/show.rb", "rails_generators/nifty_scaffold/templates/action_tests/update.rb", "rails_generators/nifty_scaffold/templates/actions/create.rb", "rails_generators/nifty_scaffold/templates/actions/destroy.rb", "rails_generators/nifty_scaffold/templates/actions/edit.rb", "rails_generators/nifty_scaffold/templates/actions/index.rb", "rails_generators/nifty_scaffold/templates/actions/new.rb", "rails_generators/nifty_scaffold/templates/actions/show.rb", "rails_generators/nifty_scaffold/templates/actions/update.rb", "rails_generators/nifty_scaffold/templates/controller.rb", "rails_generators/nifty_scaffold/templates/controller_spec.rb", "rails_generators/nifty_scaffold/templates/controller_test.rb", "rails_generators/nifty_scaffold/templates/fixtures.yml", "rails_generators/nifty_scaffold/templates/helper.rb", "rails_generators/nifty_scaffold/templates/migration.rb", "rails_generators/nifty_scaffold/templates/model.rb", "rails_generators/nifty_scaffold/templates/model_spec.rb", "rails_generators/nifty_scaffold/templates/model_test.rb", "rails_generators/nifty_scaffold/templates/views/_form.html.erb", "rails_generators/nifty_scaffold/templates/views/edit.html.erb", "rails_generators/nifty_scaffold/templates/views/index.html.erb", "rails_generators/nifty_scaffold/templates/views/new.html.erb", "rails_generators/nifty_scaffold/templates/views/show.html.erb", "rails_generators/nifty_scaffold/USAGE", "README", "tasks/deployment.rake", "test/test_helper.rb", "test/test_nifty_config_generator.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb", "TODO", "nifty-generators.gemspec"]
18
+ s.has_rdoc = true
19
+ s.homepage = %q{http://github.com/ryanb/nifty-generators}
20
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Nifty-generators", "--main", "README"]
21
+ s.require_paths = ["lib"]
22
+ s.rubyforge_project = %q{nifty-generators}
23
+ s.rubygems_version = %q{1.0.0}
24
+ s.summary = %q{A collection of useful generator scripts for Rails.}
25
+ s.test_files = ["test/test_helper.rb", "test/test_nifty_config_generator.rb", "test/test_nifty_layout_generator.rb", "test/test_nifty_scaffold_generator.rb"]
26
+ end
27
+
28
+
29
+ # # Original Rakefile source (requires the Echoe gem):
30
+ #
31
+ # require 'rubygems'
32
+ # require 'rake'
33
+ #
34
+ # begin
35
+ # require 'echoe'
36
+ #
37
+ # Echoe.new('nifty-generators', '0.1.3') do |p|
38
+ # p.summary = "A collection of useful generator scripts for Rails."
39
+ # p.description = "A collection of useful generator scripts for Rails."
40
+ # p.url = "http://github.com/ryanb/nifty-generators"
41
+ # p.author = 'Ryan Bates'
42
+ # p.email = "ryan (at) railscasts (dot) com"
43
+ # p.ignore_pattern = ["script/*", "*.gemspec"]
44
+ # end
45
+ #
46
+ # rescue LoadError => boom
47
+ # puts "You are missing a dependency required for meta-operations on this gem."
48
+ # puts "#{boom.to_s.capitalize}."
49
+ # end
50
+ #
51
+ # Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
@@ -0,0 +1,23 @@
1
+ Description:
2
+ The nifty_config generator creates YAML file in your config
3
+ directory and an initializer to load this config. The config has a
4
+ separate section for each environment. This is a great place to put
5
+ any config settings you don't want in your app.
6
+
7
+ The config is loaded into a constant called APP_CONFIG by default,
8
+ this changes depending on the name you choose to pass the generator.
9
+ Use this constant to access the config settings like this.
10
+
11
+ APP_CONFIG[:some_setting]
12
+
13
+
14
+ Examples:
15
+ script/generate nifty_config
16
+
17
+ Config: config/app_config.yml
18
+ Initializer: config/initializers/load_app_config.rb
19
+
20
+ script/generate nifty_config passwords
21
+
22
+ Config: config/passwords_config.yml
23
+ Initializer: config/initializers/load_passwords_config.rb
@@ -0,0 +1,32 @@
1
+ class NiftyConfigGenerator < Rails::Generator::Base
2
+ def initialize(runtime_args, runtime_options = {})
3
+ super
4
+ @name = @args.first || 'app'
5
+ end
6
+
7
+ def manifest
8
+ record do |m|
9
+ m.directory 'config/initializers'
10
+
11
+ m.template "load_config.rb", "config/initializers/load_#{file_name}_config.rb"
12
+ m.file "config.yml", "config/#{file_name}_config.yml"
13
+ end
14
+ end
15
+
16
+ def file_name
17
+ @name.underscore
18
+ end
19
+
20
+ def constant_name
21
+ @name.underscore.upcase
22
+ end
23
+
24
+ protected
25
+ def banner
26
+ <<-EOS
27
+ Creates config and loader files.
28
+
29
+ USAGE: #{$0} #{spec.name} [config_name]
30
+ EOS
31
+ end
32
+ end
@@ -0,0 +1,8 @@
1
+ development:
2
+ domain: localhost:3000
3
+
4
+ test:
5
+ domain: test.host
6
+
7
+ production:
8
+ domain: example.com
@@ -0,0 +1,2 @@
1
+ raw_config = File.read(RAILS_ROOT + "/config/<%= file_name %>_config.yml")
2
+ <%= constant_name %>_CONFIG = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
@@ -0,0 +1,25 @@
1
+ Description:
2
+ The nifty_layout generator creates a basic layout, stylesheet and
3
+ helper which will give some structure to a starting Rails app.
4
+
5
+ The generator takes one argument which will be the name of the
6
+ layout and stylesheet files. If no argument is passed then it defaults
7
+ to "application".
8
+
9
+ The helper module includes some methods which can be called in any
10
+ template or partial to set variables to be used in the layout, such as
11
+ page title and javascript/stylesheet includes.
12
+
13
+ Examples:
14
+ script/generate nifty_layout
15
+
16
+ Layout: app/views/layouts/application.html.erb
17
+ Stylesheet: public/stylesheets/application.css
18
+ Helper: app/helpers/layout_helper.rb
19
+
20
+
21
+ script/generate nifty_layout admin
22
+
23
+ Layout: app/views/layouts/admin.html.erb
24
+ Stylesheet: public/stylesheets/admin.css
25
+ Helper: app/helpers/layout_helper.rb
@@ -0,0 +1,31 @@
1
+ class NiftyLayoutGenerator < Rails::Generator::Base
2
+ def initialize(runtime_args, runtime_options = {})
3
+ super
4
+ @name = @args.first || 'application'
5
+ end
6
+
7
+ def manifest
8
+ record do |m|
9
+ m.directory 'app/views/layouts'
10
+ m.directory 'public/stylesheets'
11
+ m.directory 'app/helpers'
12
+
13
+ m.template "layout.html.haml", "app/views/layouts/#{file_name}.html.haml"
14
+ m.file "stylesheet.sass", "public/stylesheets/sass/#{file_name}.sass"
15
+ m.file "helper.rb", "app/helpers/layout_helper.rb"
16
+ end
17
+ end
18
+
19
+ def file_name
20
+ @name.underscore
21
+ end
22
+
23
+ protected
24
+ def banner
25
+ <<-EOS
26
+ Creates generic layout, stylesheet, and helper files.
27
+
28
+ USAGE: #{$0} #{spec.name} [layout_name]
29
+ EOS
30
+ end
31
+ end
@@ -0,0 +1,23 @@
1
+ # These helper methods can be called in your template to set variables to be used in the layout
2
+ # This module should be included in all views globally,
3
+ # to do so you may need to add this line to your ApplicationController
4
+ # helper :layout
5
+ module LayoutHelper
6
+ def title(page_title, show_title = true)
7
+ @content_for_title = page_title.to_s
8
+ @show_title = show_title
9
+ end
10
+
11
+ def show_title?
12
+ @show_title
13
+ end
14
+
15
+ def stylesheet(*args)
16
+ content_for(:head) { stylesheet_link_tag(*args.map(&:to_s)) }
17
+ end
18
+
19
+ def javascript(*args)
20
+ args = args.map { |arg| arg == :defaults ? arg : arg.to_s }
21
+ content_for(:head) { javascript_include_tag(*args) }
22
+ end
23
+ end
@@ -0,0 +1,51 @@
1
+ Description:
2
+ Scaffolds an entire resource, from model and migration to controller and
3
+ views. The resource is ready to use as a starting point for your restful,
4
+ resource-oriented application. Tests or specs are also generated depending
5
+ on if you have a "spec" directory or not.
6
+
7
+ IMPORTANT: This generator uses the "title" helper method which is generated
8
+ by the nifty_layout generator. You may want to run that generator first.
9
+
10
+ Usage:
11
+ Pass the name of the model, either CamelCased or under_scored, as the first
12
+ argument, and an optional list of attribute pairs and controller actions.
13
+
14
+ If no controller actions are specified, they will default to index, show,
15
+ new, create, edit, update, and destroy.
16
+
17
+ IMPORTANT: If no attribute pairs are specified, no model will be generated.
18
+ It will try to determine the attributes from an existing model.
19
+
20
+ Attribute pairs are column_name:sql_type arguments specifying the
21
+ model's attributes. Timestamps are added by default, so you don't have to
22
+ specify them by hand as 'created_at:datetime updated_at:datetime'.
23
+
24
+ For example, `nifty_scaffold post name:string content:text hidden:boolean`
25
+ gives you a model with those three attributes, a controller that handles
26
+ the create/show/update/destroy, forms to create and edit your posts, and
27
+ an index that lists them all, as well as a map.resources :posts
28
+ declaration in config/routes.rb.
29
+
30
+ Adding an "!" in the mix of arguments will invert the passed controller
31
+ actions. This will include all 7 controller actitons except the ones
32
+ mentioned. This option doesn't effect model attributes.
33
+
34
+ Examples:
35
+ script/generate nifty_scaffold post
36
+
37
+ Will create a controller called "posts" it will contain all seven
38
+ CRUD actions along with the views. A model will NOT be created,
39
+ instead it will look for an existing model and use those attributes.
40
+
41
+ script/generate nifty_scaffold post name:string content:text index new edit
42
+
43
+ Will create a Post model and migration file with the name and content
44
+ attributes. It will also create a controller with index, new, create,
45
+ edit, and update actions. Notice the create and update actions are
46
+ added automatically with new and edit.
47
+
48
+ script/generate nifty_scaffold post ! show new
49
+
50
+ Creates a posts controller (no model) with index, edit, update, and
51
+ destroy actions.