So I have the following code that I wanted to make a little more readable:
user = User.find_by_username(username)
user = User.new(credentials) if user.nil?
Essentially the first line is the default, the following line instantiates itself if it's not already set.
Is there a way I can clean this up a bit and get it onto a single line of code? Something like this maybe:
user = User.find_by_username(username) || User.new(credentials)
Edit
I now realize the the code I provided does exactly what I need, sorry for wasting cyberspace but feel free to suggest alternative solutions.