Skip to content

Instantly share code, notes, and snippets.

@lin
Created March 6, 2015 23:58
Show Gist options
  • Select an option

  • Save lin/1a720acd702ad271e1f9 to your computer and use it in GitHub Desktop.

Select an option

Save lin/1a720acd702ad271e1f9 to your computer and use it in GitHub Desktop.
Better ruby
# if nil set value after ||
tweets = timeline.tweets || []
def sign_in
current_session || sign_user_in
end
set_or_not_var ||= 2
options[:country] ||= 'us'
# conditional return
options[:path] = if list_name
"/#{user_name}/#{list_name}"
else
"/#{user_name}"
end
# modules
ActiveRecord::concern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment