Skip to content

Instantly share code, notes, and snippets.

@nicholasjhenry
Created April 25, 2014 03:34
Show Gist options
  • Save nicholasjhenry/11277031 to your computer and use it in GitHub Desktop.
Save nicholasjhenry/11277031 to your computer and use it in GitHub Desktop.
Hash Selection Pattern
{ true => -> { self.respond_with @post, @comment },
false => -> { self.xms_error @comment }
}[@comment.save].call
{ success: 'alert-success',
error: 'alert-danger',
notice: 'alert-info',
warn: 'alert-warning' }[flash[:type]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment