Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

copy editing [ci skip]

  • Loading branch information...
commit d897255f8a25c72aa72f14d2f82cb87058447fac 1 parent 219342b
Vijay Dev vijaydev authored

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. +5 5 guides/source/engines.textile
10 guides/source/engines.textile
Source Rendered
@@ -548,16 +548,16 @@ Now instead of the ugly Ruby object output the author's name will be displayed.
548 548
549 549 h5. Using a controller provided by the application
550 550
551   -Because Rails controllers generally share code for for things like authentication and accessing session variables, by default they inherit from ApplicationController. Rails engines, however are scoped to run independently from the main application, so each engine gets a scoped ApplicationController. This namespace prevents code collisions, but often engine controllers should access methods in the main application's ApplicationController. An easy way to provide this acess is to change the engine's scoped ApplicationController to inherit from the main application's ApplicationController. For our Blorgh engine this would be done by changing +app/controllers/blorgh/application_controller.rb+ to look like:
  551 +Because Rails controllers generally share code for things like authentication and accessing session variables, by default they inherit from <tt>ApplicationController</tt>. Rails engines, however are scoped to run independently from the main application, so each engine gets a scoped +ApplicationController+. This namespace prevents code collisions, but often engine controllers should access methods in the main application's +ApplicationController+. An easy way to provide this access is to change the engine's scoped +ApplicationController+ to inherit from the main application's +ApplicationController+. For our Blorgh engine this would be done by changing +app/controllers/blorgh/application_controller.rb+ to look like:
552 552
553 553 <ruby>
554   - class Blorgh::ApplicationController < ApplicationController
555   - end
  554 +class Blorgh::ApplicationController < ApplicationController
  555 +end
556 556 </ruby>
557 557
558   -By default, the engine's controllers inherit from Blorgh::ApplicationController. So, after making this change they will have access to the main applications ApplicationController as though they were part of the main application.
  558 +By default, the engine's controllers inherit from <tt>Blorgh::ApplicationController</tt>. So, after making this change they will have access to the main applications +ApplicationController+ as though they were part of the main application.
559 559
560   -This change does require that the engine is run from a Rails application that has an ApplicationController.
  560 +This change does require that the engine is run from a Rails application that has an +ApplicationController+.
561 561
562 562 h4. Configuring an engine
563 563

0 comments on commit d897255

Please sign in to comment.
Something went wrong with that request. Please try again.