RFC: Alias Behavior

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.

http://silverinsanity.com/~benji/radiant/alias_behavior.rb

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?)

Thanks,
~~ Brian

Looks interesting, Brian. I know I’m wasn’t good in the past about this
myself, but some tests would be nice.

Sean C.
seancribbs.com

On Dec 28, 2006, at 10:03 AM, Sean C. wrote:

Looks interesting, Brian. I know I’m wasn’t good in the past about
this myself, but some tests would be nice.

Sean C.
seancribbs.com

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.

~~ Brian

Brian G. wrote:

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)

Strange, that would indicate that it can’t find Rails. Is Rails in your
vendor directory or do you have it installed via gems?


John L.
http://wiseheartdesign.com

On Dec 28, 2006, at 12:05 PM, John W. Long wrote:

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’

~~ Brian

On Dec 28, 2006, at 10:03 AM, Sean C. wrote:

Looks interesting, Brian. I know I’m wasn’t good in the past about
this myself, but some tests would be nice.

Sean C.
seancribbs.com

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

Kinda keeps me from figuring out my own tests.

~~ Brian

On Dec 28, 2006, at 12:44 PM, John W. Long wrote:

Please file a ticket about this and I will make sure it is fixed
for the
next release.

Ticket 469:
http://dev.radiantcms.org/radiant/ticket/469

~~ Brian

Brian G. wrote:

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):

$ svn co http://dev.radiantcms.org/svn/radiant/tags/rel_0-5-2/radiant
$ cd radiant
$ cp config/database.mysql.yml config/database.yml
$ script/setup_database
$ rake

Please file a ticket about this and I will make sure it is fixed for the
next release.


John L.
http://wiseheartdesign.com