Explain that NamedBase makes the variable 'name' available to the script.

This commit is contained in:
David N. Welton
2010-11-22 16:05:53 +01:00
parent 8c17d30d68
commit 0598bd4d2d

View File

@@ -92,7 +92,7 @@ class InitializerGenerator < Rails::Generators::NamedBase
end
</ruby>
First, notice that we are inheriting from +Rails::Generators::NamedBase+ instead of +Rails::Generators::Base+. This means that our generator expects at least one argument, which will be the name of the initializer.
First, notice that we are inheriting from +Rails::Generators::NamedBase+ instead of +Rails::Generators::Base+. This means that our generator expects at least one argument, which will be the name of the initializer, and will be available in our code in the variable +name+.
We can see that by invoking the description of this new generator (don't forget to delete the old generator file):