Skip to content

Commit

Permalink
When passing in an object to TagList.from that responds to join (like…
Browse files Browse the repository at this point in the history
… an array), join it with the delimiter
  • Loading branch information
tomeric committed Apr 30, 2010
1 parent 976cab3 commit ee5a295
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/acts_as_taggable_on/tag_list.rb
Expand Up @@ -16,7 +16,8 @@ def initialize(*args)
# tag_list = TagList.from("One , Two, Three")
# tag_list # ["One", "Two", "Three"]
def self.from(string)
string = string.join(", ") if string.respond_to?(:join)
glue = delimiter.ends_with?(" ") ? delimiter : "#{delimiter} "
string = string.join(glue) if string.respond_to?(:join)

new.tap do |tag_list|
string = string.to_s.dup
Expand Down

0 comments on commit ee5a295

Please sign in to comment.