Skip to content

Commit

Permalink
better config.autoload_paths instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
alexch committed Aug 15, 2012
1 parent 13f831a commit 019e8de
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
2 changes: 2 additions & 0 deletions lib/erector/rails/railtie.rb
Expand Up @@ -7,5 +7,7 @@ class Railtie < ::Rails::Railtie
# works. For now, you must add the following to config/application.rb:
#
# config.autoload_paths += %W(#{config.root}/app)
#
# (Maybe ::Rails.configuration.autoload_paths will work?)
end
end
16 changes: 10 additions & 6 deletions web/rails.html
Expand Up @@ -238,7 +238,7 @@ <h2>Table of Contents</h2>
<li><a href="#rails">Using Erector from Ruby on Rails</a></li>
<li><a href="#tool">Erector tool: Command-line conversion to and from HTML</a></li>
<li><a href="#pagelayoutinheritance">Page Layout Inheritance</a></li>
<li><a href="#erectorlayoutsinrails">Erector Layouts in Rails</a></li>
<li><a href="#erectorwidgetsasrailslayouts">Erector Widgets as Rails Layouts</a></li>
<li><a href="#instancevariables">Instance Variables</a></li>
<li><a href="#moreaboutrails">More about Rails</a></li>
</ol>
Expand Down Expand Up @@ -295,6 +295,10 @@ <h2>2. Using Erector from Ruby on Rails</h2>
to
<code>config/environment.rb</code>
. You also should delete (or rename) any other view files with the same base name that might be getting in the way.</p>
<p>You must also add app to the class load path. Put this line into
<code>config/application.rb</code>
<pre>config.autoload_paths += %W(#{config.root}/app)</pre>
</p>
<p>Currently there is only partial support for some standard Rails features like partials, layouts, assigns, and helpers. Check the <a href="http://googlegroups.com/group/erector">erector Google Groups mailing list</a> for status updates on these features.</p>
<a name="tool"></a>
<h2>3. Erector tool: Command-line conversion to and from HTML</h2>
Expand Down Expand Up @@ -388,24 +392,24 @@ <h2>4. Page Layout Inheritance</h2>
</p>
<p>Notice how this mechanism allows you to...</p>
<ul>
<li>Set instance variables (e.g. title)</li>
<li>Set instance variables (e.g. page_title)</li>
<li>Override sections completely (e.g. render_body)</li>
<li>Append to standard content (e.g. render_navbar)</li>
<li>Use standard content unchanged (e.g. render_footer)</li>
</ul>
<p>all in a straightforward, easily understood paradigm (OO inheritance). (No more weird yielding to invisible, undocumented closures!)</p>
<p>Check out <a href="/rdoc/Erector/Widgets/Page.html">Erector::Widgets::Page</a> for a widget that does a lot of this for you, including rendering <a href="#externals">externals</a> in the HEAD element.</p>
<a name="erectorlayoutsinrails"></a>
<h2>5. Erector Layouts in Rails</h2>
<p>Check out <a href="/rdoc/Erector/Widgets/Page.html">Erector::Widgets::Page</a> for a widget that does a lot of this for you, including rendering <a href="userguide.html#externals">externals</a> in the HEAD element.</p>
<p>To use layout inheritance in Rails, declare
<code>layout nil</code>
in
<code>app/controllers/application.rb</code>
and then define your Page parent class as
(or in an individual controller class) and then define your Page parent class as
<code>class Views::Layouts::Page</code>
in
<code>app/views/layouts</code>
as usual.</p>
<a name="erectorwidgetsasrailslayouts"></a>
<h2>5. Erector Widgets as Rails Layouts</h2>
<p>To use an Erector widget as a regular Rails layout, you'll have to set things up a bit differently.<br />
<code>app/views/layouts/application.rb:</code>
<pre class="sh_ruby">class Views::Layouts::Application &lt; Erector::Widget
Expand Down
6 changes: 6 additions & 0 deletions web/rails.rb
Expand Up @@ -88,6 +88,12 @@ def content
text ". You also should delete (or rename) any other view files with the same base name that might be getting in the way."
end

p {
text "You must also add app to the class load path. Put this line into "
code "config/application.rb"
pre 'config.autoload_paths += %W(#{config.root}/app)'
}

p do
text "Currently there is only partial support for some standard Rails features like partials, layouts, assigns, and helpers. Check the "
a "erector Google Groups mailing list", :href => "http://googlegroups.com/group/erector"
Expand Down
6 changes: 4 additions & 2 deletions web/readme.html
Expand Up @@ -232,6 +232,8 @@
</li><li>
<p><a href="mailto:erector@googlegroups.com">erector@googlegroups.com</a></p>
</li><li>
<p><a href="http://github.com/pivotal/erector">github.com/pivotal/erector</a></p>
</li><li>
<p><a
href="http://www.pivotaltracker.com/projects/482">www.pivotaltracker.com/projects/482</a></p>
</li></ul>
Expand Down Expand Up @@ -281,8 +283,8 @@ <h2 id="label-SYNOPSIS">SYNOPSIS</h2>
<h2 id="label-REQUIREMENTS">REQUIREMENTS</h2>

<p>The gem depends on rake and treetop, although this is just for using the
command-line tool, so deployed applications won’t need these. The
Rails-dependent code is now separated so you can use Erector cleanly in a
command-line tool, so deployed applications won’t need these. The
Rails-dependent code is now separated so you can use Erector cleanly in a
non-Rails app.</p>

<h2 id="label-INSTALL">INSTALL</h2>
Expand Down

0 comments on commit 019e8de

Please sign in to comment.