Ye Olde Form, Sessions and Params hash type questions

Phillip You are a genius :slight_smile:

That worked a treat. Thanks.

I'll have look up "HashWithIndifferentAccess" and "merge!" to see what they do.

Thanks for the help. Much appreciated.

Cheers, Alex

Phillip Koebbe wrote:

Phillip You are a genius :slight_smile:

Um, actually, I just had a memory of having to do the same thing two weeks ago :slight_smile:

That worked a treat. Thanks.

Wonderful!

I'll have look up "HashWithIndifferentAccess" and "merge!" to see what they do.

I'll save you a little bit of digging. HashWithIndifferentAccess is a class that Rails provides which allows you to access a value by using either a string key or symbol key. So params[:id] is the same as params['id'] because params is a HashWithIndifferentAccess. That's the bear that I wrestled with a couple of weeks ago (thanks again ///ark!), but once I learned about HWIA, all is much better.

As for merge!, take a look at

http://www.ruby-doc.org/core/

and scroll down the Class list (in the middle) to Hash.

Peace, Phillip