# Accessing params\[\] inside a tag

**URL:** <https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271>\
**Category:** Radiant CMS\
**Created:** [May 16, 2007, 6:25am UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271 "2007-05-16T06:25:26Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 16, 2007, 6:25am UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/1 "2007-05-16T06:25:26Z")

</div>

Hi.  
I am developing a family of tags that should do the following:

- find\_by\_id a given record for a Model in the database  
-show field values for that record  
This tags are defined in a Model which inherits from Page

This tag should work inside a radiant page called through a normal  
SiteController#show\_page action.  
I pass the id for the record to be found as a param in the GET request.  
I  
obtain the following log:

Processing SiteController#show\_page (for 127.0.0.1 at 2007-05-16  
06:06:03)  
[GET]  
Parameters: {“url”=\>"/en/links/singlelink", “action”=\>“show\_page”,  
“id”=\>“22”,  
“controller”=\>“site”}

The problem is that I cannot find a way to retrieve the value of the  
‘id’  
param in the code for tags which are placed in the called page.  
I have tried the following (without success)  
curId = params[:id]  
curId = tag.locals.params[:id]  
curId = tag.globals.params[:id]  
curId = tag.locals.page.params[:id]

Am I missing a gotcha?  
Thanks in advance for any hint

Luca Erzegovesi  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 16, 2007, 6:29am UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/2 "2007-05-16T06:29:26Z")

</div>

> The problem is that I cannot find a way to retrieve the value  
> of the ‘id’  
> param in the code for tags which are placed in the called page.  
> I have tried the following (without success)  
> curId = params[:id]  
> curId = tag.locals.params[:id]  
> curId = tag.globals.params[:id]  
> curId = tag.locals.page.params[:id]

tag.globals.page.request.params[:id]

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 18, 2007, 6:02am UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/3 "2007-05-18T06:02:54Z")

</div>

Luca,

I have developed an extension that allows for the looking up of records  
and the displaying of field info. I haven’t packaged it and made it  
available as of yet since I still wanted to add a few more features and  
clean it up; however, you’re welcome to it.

If you’re interested, just let me know.  
Mario

mlanza …AT… comcast …DOT… net

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 18, 2007, 7:24am UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/4 "2007-05-18T07:24:18Z")

</div>

Hi Mario,

Could I also get a copy of your extension?

Thanks,  
saji

- Mario L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2007-05-18 06:02:54 +0200]:

> mlanza …AT… comcast …DOT… net
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
Saji N. Hameed

APEC Climate Center +82 51 668 7470  
National Pension Corporation Busan Building 12F  
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed\_email\_address@domain.invalid  
KOREA

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 18, 2007, 3:33pm UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/5 "2007-05-18T15:33:49Z")

</div>

I have made my extension available. See:  
[http://www.ruby-forum.com/topic/108491#247243](http://www.ruby-forum.com/topic/108491#247243)

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 18, 2007, 6:17am UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/6 "2007-05-18T06:17:12Z")

</div>

Hi Mario,

Could I also get a copy of your extension?

Thanks,  
saji

- Mario L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2007-05-18 06:02:54 +0200]:

> mlanza …AT… comcast …DOT… net
> 
> –  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
Saji N. Hameed

APEC Climate Center +82 51 668 7470  
National Pension Corporation Busan Building 12F  
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed\_email\_address@domain.invalid  
KOREA

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 20, 2007, 9:04am UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/7 "2007-05-20T09:04:03Z")

</div>

Hello,

I am trying out the “How To” by Sean C. on how to create global  
tags in a plugin.  
When I try to run the command:

ruby script/generate plugin 00\_mytags

I get the message :

Couldn’t find ‘plugin’ generator

What could be wrong?

Thanks,  
saji

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 20, 2007, 11:55am UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/8 "2007-05-20T11:55:18Z")

</div>

This is an old tutorial. The use of plugins for global tags has been  
deprecated and replaced with extensions. You will want to run “ruby  
scipt/generate extension my\_extension\_name” instead. Essentially, you  
will need to put the new tags in the lib folder (or model folder) of  
the extension, which is essentially a mini rails app.

Take a look at the example extensions in the repository for hints on  
how to make global tags. John is working on a tutorial and posted a  
draft of it a few days back. It isn’t done yet, but has lots of great  
information. Dig through the archives, it wasn’t more than a week ago.

Keith B.  
removed\_email\_address@domain.invalid  
Tel: +49-7731-7983830

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 21, 2007, 2:27pm UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/9 "2007-05-21T14:27:52Z")

</div>

Keith, David:

Thank you very much. I am happily able to extend the tags now.  
Thanks to Sean C. for the dynamic navigation tags (dug up from  
the mailing list archive) which was the one I wanted to implement.

saji

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 20, 2007, 8:44pm UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/10 "2007-05-20T20:44:07Z")

</div>

On May 20, 2007, at 4:54 AM, Keith B. wrote:

> Dig through the archives, it wasn’t more than a week ago.

May 16 and the subject of the thread was: Creating extension

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 21, 2007, 5:12pm UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/11 "2007-05-21T17:12:21Z")

</div>

You mean the sitemapper? Either way, you’re welcome; pay it forward.

Sean

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [May 22, 2007, 2:30am UTC](https://www.ruby-forum.com/t/accessing-params-inside-a-tag/104271/12 "2007-05-22T02:30:40Z")

</div>

Sean,  
I meant the “if\_ancestor\_or\_self” tag.

```
    tag "if_ancestor_or_self" do |tag|
            tag.expand if (tag.globals.actual_page.ancestors +

```

[tag.globals.actual\_page]).include?(tag.locals.page)

saji

- Sean C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [2007-05-21 08:11:04 -0700]:

> > > how to make global tags. John is working on a tutorial and posted a
> > > 
> > > > Couldn’t find ‘plugin’ generator  
> > > > Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> > > > Post: removed\_email\_address@domain.invalid  
> > > > Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> > > > Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)
> 
> * * *
> 
> Radiant mailing list  
> Post: removed\_email\_address@domain.invalid  
> Search: [http://radiantcms.org/mailing-list/search/](http://radiantcms.org/mailing-list/search/)  
> Site: [http://lists.radiantcms.org/mailman/listinfo/radiant](http://lists.radiantcms.org/mailman/listinfo/radiant)

–  
Saji N. Hameed

APEC Climate Center +82 51 668 7470  
National Pension Corporation Busan Building 12F  
Yeonsan 2-dong, Yeonje-gu, BUSAN 611705 removed\_email\_address@domain.invalid  
KOREA
