Ignore whitespace around the commas when splitting a user's list of
authorTom Hughes <tom@compton.nu>
Sun, 18 Apr 2010 11:44:53 +0000 (11:44 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 19 Apr 2010 13:28:03 +0000 (14:28 +0100)
preferred languages. Closes #2891.

app/models/user.rb

index 0b8b512..f02c9a5 100644 (file)
@@ -85,7 +85,7 @@ class User < ActiveRecord::Base
   end
 
   def languages
-    attribute_present?(:languages) ? read_attribute(:languages).split(",") : []
+    attribute_present?(:languages) ? read_attribute(:languages).split(/ *, */) : []
   end
 
   def languages=(languages)