marenz has quit [Ping timeout: 240 seconds]
marenz has joined #amber
asdf___ has joined #amber
asdf___ has quit [Client Quit]
feepbot has quit [Ping timeout: 248 seconds]
feepbot has joined #amber
<
FromGitter>
<sclee15> How can i get params like nil safe way? ⏎ ```params[:status] || "123"```
<
FromGitter>
<sclee15> if i access with non-existent key then it fails.
marenz has quit [Remote host closed the connection]
<
FromGitter>
<Blacksmoke16> try like `params[:status]? || "123"`
<
FromGitter>
<Blacksmoke16> @sclee15
<
FromGitter>
<sclee15> @Blacksmoke16 thanks.
<
FromGitter>
<sclee15> But somehow i dont understand params[:status] throws error. I thought it is null.
<
FromGitter>
<robacarp> @sclee15 hashes in crystal are like that. You want `params[:status]?`
<
FromGitter>
<Blacksmoke16> they throw by default, adding the ? makes it return nil if not found
<
FromGitter>
<Blacksmoke16> @sclee15
<
FromGitter>
<sclee15> Thanks.
wontruefree has joined #amber
<
robacarp>
we should make the error message there a little more helpful
wontruefree has quit [Quit: bye]
wontruefree has joined #amber
wontruefree has quit [Quit: this is not the client you are looking for]
ZeroPointEnergy has joined #amber
ZeroPointEnergy has quit [Quit: Leaving.]
hightower5 has joined #amber
hightower4 has quit [Ping timeout: 248 seconds]
hightower5 is now known as hightower4