KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Should I use if defined? return @current_user_session if defined?(@current_user_session) @current_user_session = UserSession.find Or ||= @current_user_session ||= UserSession.find I noticed the if defined? method being used more and more recently. Is there any advantage to one over the other? Personally, I prefer ||= for readability. I also think Rails might have a memoize macro which provides this behavior transparently. Is this the case?
Tags (comma-separated)
Save Edits
Cancel