How to use ruby method .present?
I have a method like this in rails app:
def current_user
return @current_user if @current_user.present?
@current_user = current_user_session && current_user_session.record
end
I haven't used the .present? method before so I went into my interactive
ruby shell to play around with it.
Whenever I use xxx.present? it returns a NoMethodError. It doesn't matter
if xxx is a string, number, array anything.
How can I use this method?
No comments:
Post a Comment