I just hacked together a dirt-simple “alias” behavior. This came out
of a desire to have a second domain serve up a portion of the main
site (using the Virtual Domain Behavior). All it does is take the
“source” page part and use that to find (by slug) another page to
use. It allows children of the original page to be overridden by
children of the alias page.
To use it, just place the above file in RAILS_ROOT/app/behaviors
As a note, “find_page_by_path” seems like it would be generically
useful, especially in environments where the page URLs are very
different from the page slugs. (Along with <r:if_page path=“”> and
<r:unless_page>, which would check to see if the current page matches
a slug path. I’ll write those up when/if I need them.)
If anyone has any questions or comments, feel free to let me know.
If you spot any glaring errors, PLEASE let me know. I’d like to have
people more familiar with Radiant’s core take a peek at it before
trying to use it in a production environment.
(BTW, is mental stable enough for production use and is there an easy
migration path from 0.5.2 yet?)
Yeah, that’s part of the “hacked together” part. I didn’t know how
it would end up working when I started, so I couldn’t attempt tests.
I’ll work on fixing that in a bit.
Strange, that would indicate that it can’t find Rails. Is Rails in
your
vendor directory or do you have it installed via gems?
Both, actually. I have the vendor/rails from the tarball and Rails
1.1.6 installed via RubyGems. Both ruby (1.8.4) and gem (0.8.11) are
installed via fink.
What I find truly odd is that it seems to jump from vendor to gems:
from /sw/var/lib/gems/1.8/gems/actionpack-1.12.5/lib/
action_controller/integration.rb:16
from /sw/lib/ruby/1.8/rubygems/custom_require.rb:21:in require' from /Users/brian/dev/radiant/radiant-0.5.2/test/../ config/../vendor/rails/activerecord/lib/../../activesupport/lib/ active_support/dependencies.rb:147:inrequire’
I can’t get any tests running in my 0.5.2 setup (from
radiant-0.5.2-2.tgz). Any time I try to run any test, I get errors
like the following:
/Users/brian/dev/radiant/radiant-0.5.2/test/…/config/…/vendor/rails/
activerecord/lib/…/…/activesupport/lib/active_support/
dependencies.rb:100:in const_missing': uninitialized constant ActionController::TestProcess (NameError) from /sw/var/lib/gems/1.8/gems/actionpack-1.12.5/lib/ action_controller/integration.rb:16 from /sw/lib/ruby/1.8/rubygems/custom_require.rb:21:in require’
from /Users/brian/dev/radiant/radiant-0.5.2/test/…/
config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/
active_support/dependencies.rb:147:in require' from /Users/brian/dev/radiant/radiant-0.5.2/test/../ config/../vendor/rails/railties/lib/test_help.rb:10 from /sw/lib/ruby/1.8/rubygems/custom_require.rb:21:in require’
from /Users/brian/dev/radiant/radiant-0.5.2/test/…/
config/…/vendor/rails/activerecord/lib/…/…/activesupport/lib/
active_support/dependencies.rb:147:in `require’
from ./…/test_helper.rb:8
from page_test.rb:1
What I find truly odd is that it seems to jump from vendor to gems:
Mmmm. This seems to be a problem with the tarball. I just downloaded it
myself and am receiving the same error.
For now, I’d recommend installing via subversion (which seemed to work
nicely for me):