Skip to content

Commit

Permalink
Explain that NamedBase makes the variable 'name' available to the scr…
Browse files Browse the repository at this point in the history
…ipt.
  • Loading branch information
davidw committed Nov 22, 2010
1 parent 8c17d30 commit 0598bd4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion railties/guides/source/generators.textile
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class InitializerGenerator < Rails::Generators::NamedBase
end end
</ruby> </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): We can see that by invoking the description of this new generator (don't forget to delete the old generator file):


Expand Down

0 comments on commit 0598bd4

Please sign in to comment.