# Problem with language\_redirect extension

**URL:** <https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151>\
**Category:** Radiant CMS\
**Created:** [March 26, 2007, 1:57pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151 "2007-03-26T13:57:44Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 1:57pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/1 "2007-03-26T13:57:44Z")

</div>

Hi Giovanni,

I ran into a problem with your language\_redirect extension. I am using  
radiant 0.6RC2 and the extension directly from  
[http://svn1.hosted-projects.com/medlar/language\_redirect\_extension/language\_redirect/](http://svn1.hosted-projects.com/medlar/language_redirect_extension/language_redirect/)  
).

Ruby complains about a missing method or local variable ‘config’ (see  
error below). If I look into  
/vendor/extensions/language\_redirect/app/models/language\_redirect\_page.rb  
I can see the usage of config, but no definition.

What am I missing?

Thanks  
Nancy

— error below.  
NameError (undefined local variable or method `config’ for  
#LanguageRedirectPage:0x2b4781d13578):

/usr/lib/ruby/gems/1.8/gems/radiant-0.6.0/vendor/rails/activerecord/lib/active\_record/base.rb:1861:in  
`method\_missing’

/home/rails-apps/radiant/vendor/extensions/language\_redirect/app/models/language\_redirect\_page.rb:47:in  
`location\_map’

/home/rails-apps/radiant/vendor/extensions/language\_redirect/app/models/language\_redirect\_page.rb:35:in  
`location’

/usr/lib/ruby/gems/1.8/gems/radiant-0.6.0/vendor/rails/activerecord/lib/active\_record/base.rb:1941:in  
`find’

/home/rails-apps/radiant/vendor/extensions/language\_redirect/app/models/language\_redirect\_page.rb:34:in  
`each’

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 2:17pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/2 "2007-03-26T14:17:47Z")

</div>

I haven’t looked through my code since I wrote it, but if I remember  
correctly config is the config page part.

Try using the extension on a page with a config page part and let me  
know.

Bye,  
Giovanni

2007/3/26, Nancy C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 2:23pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/3 "2007-03-26T14:23:47Z")

</div>

Hmmm, I tried that with the following content:  
de: /de/  
\*: /en/

but no change.

Best regards,  
N.

Giovanni I. schrieb:

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 2:29pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/4 "2007-03-26T14:29:48Z")

</div>

I’ll check the sources, maybe there are some differences between the  
version I wrote it for and the current release.

I’ll let you know asap.

2007/3/26, Nancy C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 3:21pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/5 "2007-03-26T15:21:01Z")

</div>

Ok, I updated the extension, now it should work. Let me know 🙂

2007/3/26, Giovanni I. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 3:51pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/6 "2007-03-26T15:51:08Z")

</div>

That’s what I did, thanks 🙂  
You used YAML while I simply made a hash out of it. BTW what’t the  
best way to store configs now?

2007/3/26, Sean C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 4:30pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/7 "2007-03-26T16:30:17Z")

</div>

Giovanni I. wrote:

> That’s what I did, thanks 🙂  
> You used YAML while I simply made a hash out of it. BTW what’t the  
> best way to store configs now?

Write a full blown extension for it? For example, the mailer extension  
would probably be much better if it created a “Mailers” tab where you  
could create custom mailer objects just like any other object in  
Radiant. Then the extension wouldn’t need to use a custom page type. The  
radius tags could be global which would allow them to be used on any  
page.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 3:44pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/8 "2007-03-26T15:44:07Z")

</div>

About 3-4 months ago, the core team deprecated the ‘config’ part. If  
you still want to use it, feel free to nab the code for it from the  
mailer extension. I believe it’s toward the top of mailer\_page.rb.

Sean

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 4:31pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/9 "2007-03-26T16:31:17Z")

</div>

John you’re right, as usual, any pointers to examples of full blown  
extensions to get inspiration from? I stopped following the  
development lately (my fault) and I need some pointer to catch up.

2007/3/26, John W. Long [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 5:38pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/10 "2007-03-26T17:38:38Z")

</div>

Wow! You guys are so great! I go outside and sit in the sunshine for  
an hour, do my grocery shopping and come back and you have solved almost  
every problem I have in the world. The ruby error message is gone and  
is replaced by a “302 found” in my browser.

Hope this helps.  
Best regards,  
Nancy

Giovanni I. schrieb:

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 26, 2007, 4:50pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/11 "2007-03-26T16:50:20Z")

</div>

Giovanni I. wrote:

> John you’re right, as usual, any pointers to examples of full blown  
> extensions to get inspiration from? I stopped following the  
> development lately (my fault) and I need some pointer to catch up.

The ldap extension uses a lot of the new features that are available for  
extensions:

[http://dev.radiantcms.org/radiant/browser/branches/mental/extensions/ldap](http://dev.radiantcms.org/radiant/browser/branches/mental/extensions/ldap)

See also:

[http://dev.radiantcms.org/radiant/wiki/Extensions](http://dev.radiantcms.org/radiant/wiki/Extensions)

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 27, 2007, 3:51pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/12 "2007-03-27T15:51:30Z")

</div>

Giovanni - it works perfectly! Thanks a million for sharing your  
expertise.

Best regards,  
Nancy

Giovanni I. schrieb:

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 27, 2007, 3:59pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/13 "2007-03-27T15:59:33Z")

</div>

Expertise doesn’t really suit me, keep that word for people like John or  
Sean 🙂

2007/3/27, Nancy C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 27, 2007, 12:25am UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/14 "2007-03-27T00:25:18Z")

</div>

302 is a redirection. I tried the extension on a clean radiant install  
and it worked fine. Now to be sure it works create a blank config page  
part and put the following lines:

\*:/something  
de:/something  
en:/something

no spaces or newlines before or after.

2007/3/26, Nancy C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![Nancy\_C](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/90db22/32.png) [@Nancy\_C](https://www.ruby-forum.com/u/Nancy_C)\
**Post date:** [March 27, 2007, 4:02pm UTC](https://www.ruby-forum.com/t/problem-with-language-redirect-extension/90151/15 "2007-03-27T16:02:33Z")

</div>

😉 It’s all perspective…

Thanks again,  
N.

Giovanni I. schrieb:
