newbie question: how to read the ":"

I'm a total beginner at Ruby. I'm trying to read this code:

  def find_cart
  session[:cart] ||=

I'm most comfortable with PHP code, so that biases how I read this. If
I had to guess, I'd say this is saying something like "Let's create a
private method called find_cart. When called, this should check the
session array for a key called 'cart'. If there is no key called 'cart'
in the session array yet, then we create a new Cart object and store it
in the session array with a key of 'cart'."

How close did I get?

You're spot on, except session is a Hash, not an Array.

Hi --

Bingo, good job. That's pretty much exactly what happens.

Hi Jakob,

Jakob Skjerning wrote:

check the session array for a key called 'cart'.

You probably already know this, but just to make sure...

In Rails, session data is stored as a hash, not an array.

Best regards,