Skip to content

Instantly share code, notes, and snippets.

@rnmp
Created April 13, 2011 01:25
Show Gist options
  • Save rnmp/916793 to your computer and use it in GitHub Desktop.
Save rnmp/916793 to your computer and use it in GitHub Desktop.
Remove '#' or '0x' from hexadecimal color codes
def create
color = params[:color]
color[:color].gsub!(/^(#|0x)/, '')
@color = Color.new(color)
@color.user = current_user
if @color.save
redirect_to(root_url)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment