Params[:some_data] ||= [] #what does that mean?

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!

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.

On Feb 6, 10:44 am, mixplate [email protected] wrote:


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

Yes, it initiates params[:some_data] as an array if it is null.

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

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.

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!

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs