diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-02-03 22:58:43 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-02-03 22:58:43 +0000 |
commit | e4094e23f9e3740599e9eaac527fbef86ff4b4c4 (patch) | |
tree | 3f0ccba263b217a513ed7ad98d68138a850013a5 /railties/doc/guides/source/creating_plugins/controllers.txt | |
parent | c0eeb9f1e20af2a5c4f77c71fd1236e6c1584f05 (diff) | |
download | rails-e4094e23f9e3740599e9eaac527fbef86ff4b4c4.tar.gz rails-e4094e23f9e3740599e9eaac527fbef86ff4b4c4.tar.bz2 rails-e4094e23f9e3740599e9eaac527fbef86ff4b4c4.zip |
Remove all the guides
Diffstat (limited to 'railties/doc/guides/source/creating_plugins/controllers.txt')
-rw-r--r-- | railties/doc/guides/source/creating_plugins/controllers.txt | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/railties/doc/guides/source/creating_plugins/controllers.txt b/railties/doc/guides/source/creating_plugins/controllers.txt deleted file mode 100644 index 7afdef032d..0000000000 --- a/railties/doc/guides/source/creating_plugins/controllers.txt +++ /dev/null @@ -1,63 +0,0 @@ -== Controllers == - -This section describes how to add a controller named 'woodpeckers' to your plugin that will behave the same as a controller in your main app. This is very similar to adding a model. - -You can test your plugin's controller as you would test any other controller: - -*vendor/plugins/yaffle/test/woodpeckers_controller_test.rb:* - -[source, ruby] ----------------------------------------------- -require File.dirname(__FILE__) + '/test_helper.rb' -require 'woodpeckers_controller' -require 'action_controller/test_process' - -class WoodpeckersController; def rescue_action(e) raise e end; end - -class WoodpeckersControllerTest < Test::Unit::TestCase - def setup - @controller = WoodpeckersController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - ActionController::Routing::Routes.draw do |map| - map.resources :woodpeckers - end - end - - def test_index - get :index - assert_response :success - end -end ----------------------------------------------- - -This is just a simple test to make sure the controller is being loaded correctly. After watching it fail with `rake`, you can make it pass like so: - -*vendor/plugins/yaffle/lib/yaffle.rb:* - -[source, ruby] ----------------------------------------------- -%w{ models controllers }.each do |dir| - path = File.join(File.dirname(__FILE__), 'app', dir) - $LOAD_PATH << path - ActiveSupport::Dependencies.load_paths << path - ActiveSupport::Dependencies.load_once_paths.delete(path) -end ----------------------------------------------- - - -*vendor/plugins/yaffle/lib/app/controllers/woodpeckers_controller.rb:* - -[source, ruby] ----------------------------------------------- -class WoodpeckersController < ActionController::Base - - def index - render :text => "Squawk!" - end - -end ----------------------------------------------- - -Now your test should be passing, and you should be able to use the Woodpeckers controller in your app. If you add a route for the woodpeckers controller you can start up your server and go to http://localhost:3000/woodpeckers to see your controller in action. |