# Params\[:some\_data\] ||= \[\] #what does that mean?

**URL:** <https://www.ruby-forum.com/t/params-some-data-what-does-that-mean/84568>\
**Category:** Rails\
**Created:** [February 6, 2007, 1:44am UTC](https://www.ruby-forum.com/t/params-some-data-what-does-that-mean/84568 "2007-02-06T01:44:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [February 6, 2007, 1:44am UTC](https://www.ruby-forum.com/t/params-some-data-what-does-that-mean/84568/1 "2007-02-06T01:44:51Z")

</div>

is that saying

if params[:some\_data] contains something not equal to nil, continue to  
the next line of code…else make params[:some\_data] into an empty  
array?

i tried searching for ||= but no luck.

thanks for any help!

---

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [February 6, 2007, 1:56am UTC](https://www.ruby-forum.com/t/params-some-data-what-does-that-mean/84568/2 "2007-02-06T01:56:40Z")

</div>

While on that question…

Is there any reason I can set up config/routes.rb to had all of the URL  
except for the domain, no matter how many slashes or named parameters,  
to  
one ‘FigureOutTheUrl’ controller?

In that case, how do I deal with a variable number of slashes in the  
URL?

–  
We’ll give you your money back if not satisfied, but we do suspect that  
we will be quite satisfied with your money.

---

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [February 6, 2007, 2:20am UTC](https://www.ruby-forum.com/t/params-some-data-what-does-that-mean/84568/3 "2007-02-06T02:20:41Z")

</div>

On Feb 6, 10:44 am, mixplate [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> –  
> Posted viahttp://www.ruby-forum.com/.

Yes, it initiates params[:some\_data] as an array if it is null.

---

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [February 6, 2007, 2:22am UTC](https://www.ruby-forum.com/t/params-some-data-what-does-that-mean/84568/4 "2007-02-06T02:22:41Z")

</div>

Yep, that’s what ||= means… and yes it is very difficult to search the  
web for symbolic stuff like that. If you have the Agile Rails book in  
pdf form however, you can search for that expression sucessfully.

b

---

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [February 6, 2007, 2:01am UTC](https://www.ruby-forum.com/t/params-some-data-what-does-that-mean/84568/5 "2007-02-06T02:01:51Z")

</div>

what reason are you looking for? why do such a thing?

Anton A. wrote:

> While on that question…
> 
> Is there any reason I can set up config/routes.rb to had all of the URL  
> except for the domain, no matter how many slashes or named parameters,  
> to  
> one ‘FigureOutTheUrl’ controller?
> 
> In that case, how do I deal with a variable number of slashes in the  
> URL?
> 
> –  
> We’ll give you your money back if not satisfied, but we do suspect that  
> we will be quite satisfied with your money.

---

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [February 6, 2007, 2:26am UTC](https://www.ruby-forum.com/t/params-some-data-what-does-that-mean/84568/6 "2007-02-06T02:26:41Z")

</div>

One step beyond’ tressle’.

A wiki with the syntax can be

```
  /web/topic

```

No “controller”, no “action”.  
Defaults to “show”  
I would think that is what most users might expect.

Only when you need to edit

/web/topic?edit

Some wiki have a topic that is the index page, like TWiki,  
so  
/web/index  
is a case of  
/web/topic  
and not  
/web action =\> ‘index’  
Which means you can write different styles of index pages - not need to  
hack  
the code. isn’t that what a wiki is about?

mixplate said the following on 02/05/2007 08:01 PM:

> > one ‘FigureOutTheUrl’ controller?
> > 
> > In that case, how do I deal with a variable number of slashes in the  
> > URL?
> > 
> > –  
> > We’ll give you your money back if not satisfied, but we do suspect that  
> > we will be quite satisfied with your money.

–  
Hi! I’m a signature virus! Copy me into your .signature file to help me  
spread!

---

<div class="post-metadata">

**Author:** ![mixplate](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@mixplate](https://www.ruby-forum.com/u/mixplate)\
**Post date:** [February 6, 2007, 2:30am UTC](https://www.ruby-forum.com/t/params-some-data-what-does-that-mean/84568/7 "2007-02-06T02:30:41Z")

</div>

> While on that question…
> 
> Is there any reason I can set up config/routes.rb to had all of the URL  
> except for the domain, no matter how many slashes or named parameters, to  
> one ‘FigureOutTheUrl’ controller?
> 
> In that case, how do I deal with a variable number of slashes in the URL?

Yes, just make sure it is _the_ last url in routes.rb

# 

# Catchall to handle redirects for old site urls

# 

map.connect “\*args”, :controller =\> “url\_mapper”, :action =\> “index”

I’d start with a controller action of:

render :text =\> params.inspect

to see what comes in and then go from there…

-philip
