_whitelogger has joined #amber
feepbot has quit [Ping timeout: 246 seconds]
feepbot has joined #amber
<
FromGitter>
<nsuchy> What mistake am I making here?
<
FromGitter>
<damianham> user could be Nil
<
FromGitter>
<nsuchy> @damianham shouldn't the if statement only continue if it gets a truthy value?
<
FromGitter>
<nsuchy> even checking for nil doesn't fix the problem
<
FromGitter>
<damianham> I think it is to do with the way Crystal does type checking and checking for Nil
<
FromGitter>
<nsuchy> so what work around exists?
<
FromGitter>
<damianham> there is also '.not_nil!' which you can use when you absolutely know it cannot be Nil
<
FromGitter>
<damianham> i.e. user.not_nil!.is_admin?
_whitelogger has joined #amber
<
FromGitter>
<nsuchy> this ended up working
<
FromGitter>
<nsuchy> Haha
<
FromGitter>
<nsuchy> well this is interesting
<
FromGitter>
<nsuchy> not even unique to not_nil!
<
FromGitter>
<nsuchy> works too
<
FromGitter>
<nsuchy> lol
<
FromGitter>
<Blacksmoke16> you could prob rewrite that to be a bit cleaner @nsuchy
<
FromGitter>
<Blacksmoke16> something like that maybe
<
FromGitter>
<Blacksmoke16> avoids the bunch of nested conditional logic
<
FromGitter>
<Blacksmoke16> is the reasoning why that doesnt wokr