Validate Hexcode Format

Just as a follow up to the previous post, you could also do something like this:

validates_format_of(:color,
                      :with => /^(?:[0-9A-Fa-f]{6}|[0-9A-Fa-f]{3})$/,
                      :message => "Use hexcode notation only!")