Skip to content

Instantly share code, notes, and snippets.

@mahemoff
Created December 17, 2011 22:57
Show Gist options
  • Save mahemoff/1491704 to your computer and use it in GitHub Desktop.
Save mahemoff/1491704 to your computer and use it in GitHub Desktop.
check if local variable is true/false in rails template (even if undefined)
/default is "true". this will also work with default "false"(by changing "true" below to "false").
- if ( local_assigns.has_key?(:show_message) ? show_message : true )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment