diff options
Diffstat (limited to 'railties/doc/guides/creating_plugins')
7 files changed, 17 insertions, 17 deletions
diff --git a/railties/doc/guides/creating_plugins/acts_as_yaffle.txt b/railties/doc/guides/creating_plugins/acts_as_yaffle.txt index ad5aa76d61..12d40deb18 100644 --- a/railties/doc/guides/creating_plugins/acts_as_yaffle.txt +++ b/railties/doc/guides/creating_plugins/acts_as_yaffle.txt @@ -17,7 +17,7 @@ end class ActsAsYaffleTest < Test::Unit::TestCase end ------------------------------------------------------ - + [source, ruby] ------------------------------------------------------ # File: vendor/plugins/lib/acts_as_yaffle.rb @@ -40,11 +40,11 @@ module Yaffle def acts_as_something send :include, InstanceMethods end - end + end module InstanceMethods # any method placed here will apply to instaces, like @hickwall - end + end end ------------------------------------------------------ diff --git a/railties/doc/guides/creating_plugins/creating_plugins.txt b/railties/doc/guides/creating_plugins/creating_plugins.txt index e684a5850f..f2ed6ed8bb 100644 --- a/railties/doc/guides/creating_plugins/creating_plugins.txt +++ b/railties/doc/guides/creating_plugins/creating_plugins.txt @@ -1,7 +1,7 @@ The Basics of Creating Rails Plugins ==================================== -Pretend for a moment that you are an avid bird watcher. Your favorite bird is the Yaffle, and you want to create a plugin that allows other developers to share in the Yaffle goodness. +Pretend for a moment that you are an avid bird watcher. Your favorite bird is the Yaffle, and you want to create a plugin that allows other developers to share in the Yaffle goodness. In this tutorial you will learn how to create a plugin that includes: @@ -56,7 +56,7 @@ ActionController::Routing::Routes.draw do |map| map.yaffles end ------------------------------------------- - + In addition you'll learn how to: * test your plugins. diff --git a/railties/doc/guides/creating_plugins/migration_generator.txt b/railties/doc/guides/creating_plugins/migration_generator.txt index ed501e4284..598a0c8437 100644 --- a/railties/doc/guides/creating_plugins/migration_generator.txt +++ b/railties/doc/guides/creating_plugins/migration_generator.txt @@ -7,7 +7,7 @@ We'll be relying on the built-in rails generate template for this tutorial. Goi Type: script/generate - + You should see the line: Plugins (vendor/plugins): yaffle @@ -34,13 +34,13 @@ Now you can add code to your generator: class YaffleGenerator < Rails::Generator::NamedBase def manifest record do |m| - m.migration_template 'migration:migration.rb', "db/migrate", {:assigns => yaffle_local_assigns, + m.migration_template 'migration:migration.rb', "db/migrate", {:assigns => yaffle_local_assigns, :migration_file_name => "add_yaffle_fields_to_#{custom_file_name}" } end end - private + private def custom_file_name custom_name = class_name.underscore.downcase custom_name = custom_name.pluralize if ActiveRecord::Base.pluralize_table_names @@ -68,7 +68,7 @@ This does a few things: When you run the generator like script/generate yaffle bird - + You will see a new file: [source, ruby] diff --git a/railties/doc/guides/creating_plugins/odds_and_ends.txt b/railties/doc/guides/creating_plugins/odds_and_ends.txt index 91c7d5e60b..eb127f73ca 100644 --- a/railties/doc/guides/creating_plugins/odds_and_ends.txt +++ b/railties/doc/guides/creating_plugins/odds_and_ends.txt @@ -2,7 +2,7 @@ === Work with init.rb === -The plugin initializer script 'init.rb' is invoked via `eval` (not `require`) so it has slightly different behavior. +The plugin initializer script 'init.rb' is invoked via `eval` (not `require`) so it has slightly different behavior. If you reopen any classes in init.rb itself your changes will potentially be made to the wrong module. There are 2 ways around this: @@ -21,7 +21,7 @@ end OR you can use `module_eval` or `class_eval`: ---------------------------------------------------- +--------------------------------------------------- # File: vendor/plugins/yaffle/init.rb Hash.class_eval do diff --git a/railties/doc/guides/creating_plugins/preparation.txt b/railties/doc/guides/creating_plugins/preparation.txt index e200fa254f..77e3a3561f 100644 --- a/railties/doc/guides/creating_plugins/preparation.txt +++ b/railties/doc/guides/creating_plugins/preparation.txt @@ -123,7 +123,7 @@ ActiveRecord::Schema.define(:version => 0) do end # File: vendor/plugins/yaffle/test/test_helper.rb - + ENV['RAILS_ENV'] = 'test' ENV['RAILS_ROOT'] ||= File.dirname(__FILE__) + '/../../../..' diff --git a/railties/doc/guides/creating_plugins/string_to_squawk.txt b/railties/doc/guides/creating_plugins/string_to_squawk.txt index 9aaf9e2675..50516cef69 100644 --- a/railties/doc/guides/creating_plugins/string_to_squawk.txt +++ b/railties/doc/guides/creating_plugins/string_to_squawk.txt @@ -50,7 +50,7 @@ Your test should fail with `no such file to load -- ./test/../lib/core_ext.rb (L 1.) Failure ... No tests were specified -------------------------------------------------------- - + Great - now you are ready to start development. The first thing we'll do is to add a method to String called `to_squawk` which will prefix the string with the word ``squawk!''. The test will look something like this: [source, ruby] @@ -73,14 +73,14 @@ end -------------------------------------------------------- [source, ruby] --------------------------------------------------------- +-------------------------------------------------------- # File: vendor/plugins/yaffle/init.rb require "core_ext" --------------------------------------------------------- +-------------------------------------------------------- [source, ruby] --------------------------------------------------------- +-------------------------------------------------------- # File: vendor/plugins/yaffle/lib/core_ext.rb String.class_eval do diff --git a/railties/doc/guides/creating_plugins/view_helper.txt b/railties/doc/guides/creating_plugins/view_helper.txt index 1c3c4a4833..b03a190e1a 100644 --- a/railties/doc/guides/creating_plugins/view_helper.txt +++ b/railties/doc/guides/creating_plugins/view_helper.txt @@ -36,7 +36,7 @@ require "view_helpers" ActionView::Base.send :include, YaffleViewHelper --------------------------------------------------------------- -Then add the view helpers file and +Then add the view helpers file and [source, ruby] --------------------------------------------------------------- |