dm-taggings 0.11.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --colour
data/Gemfile CHANGED
@@ -1,106 +1,23 @@
1
- # If you're working on more than one datamapper gem at a time, then it's
2
- # recommended to create a local Gemfile and use this instead of the git
3
- # sources. This will make sure that you are developing against your
4
- # other local datamapper sources that you currently work on. Gemfile.local
5
- # will behave identically to the standard Gemfile apart from the fact that
6
- # it fetches the datamapper gems from local paths. This means that you can use
7
- # the same environment variables, like ADAPTER(S) or PLUGIN(S) when running
8
- # bundle commands. Gemfile.local is added to .gitignore, so you don't need to
9
- # worry about accidentally checking local development paths into git.
10
- # In order to create a local Gemfile, all you need to do is run:
11
- #
12
- # bundle exec rake local_gemfile
13
- #
14
- # This will give you a Gemfile.local file that points to your local clones of
15
- # the various datamapper gems. It's assumed that all datamapper repo clones
16
- # reside in the same directory. You can use the Gemfile.local like so for
17
- # running any bundle command:
18
- #
19
- # BUNDLE_GEMFILE=Gemfile.local bundle foo
20
- #
21
- # You can also specify which adapter(s) should be part of the bundle by setting
22
- # an environment variable. This of course also works when using the Gemfile.local
23
- #
24
- # bundle foo # dm-sqlite-adapter
25
- # ADAPTER=mysql bundle foo # dm-mysql-adapter
26
- # ADAPTERS=sqlite,mysql bundle foo # dm-sqlite-adapter and dm-mysql-adapter
27
- #
28
- # Of course you can also use the ADAPTER(S) variable when using the Gemfile.local
29
- # and running specs against selected adapters.
30
- #
31
- # For easily working with adapters supported on your machine, it's recommended
32
- # that you first install all adapters that you are planning to use or work on
33
- # by doing something like
34
- #
35
- # ADAPTERS=sqlite,mysql,postgres bundle install
36
- #
37
- # This will clone the various repositories and make them available to bundler.
38
- # Once you have them installed you can easily switch between adapters for the
39
- # various development tasks. Running something like
40
- #
41
- # ADAPTER=mysql bundle exec rake spec
42
- #
43
- # will make sure that the dm-mysql-adapter is part of the bundle, and will be used
44
- # when running the specs.
45
- #
46
- # You can also specify which plugin(s) should be part of the bundle by setting
47
- # an environment variable. This also works when using the Gemfile.local
48
- #
49
- # bundle foo # dm-migrations
50
- # PLUGINS=dm-validations bundle foo # dm-migrations and dm-validations
51
- # PLUGINS=dm-validations,dm-types bundle foo # dm-migrations, dm-validations and dm-types
52
- #
53
- # Of course you can combine the PLUGIN(S) and ADAPTER(S) env vars to run specs
54
- # for certain adapter/plugin combinations.
55
- #
56
- # Finally, to speed up running specs and other tasks, it's recommended to run
57
- #
58
- # bundle lock
59
- #
60
- # after running 'bundle install' for the first time. This will make 'bundle exec' run
61
- # a lot faster compared to the unlocked version. With an unlocked bundle you would
62
- # typically just run 'bundle install' from time to time to fetch the latest sources from
63
- # upstream. When you locked your bundle, you need to run
64
- #
65
- # bundle install --relock
66
- #
67
- # to make sure to fetch the latest updates and then lock the bundle again. Gemfile.lock
68
- # is added to the .gitignore file, so you don't need to worry about accidentally checking
69
- # it into version control.
1
+ require 'pathname'
70
2
 
71
3
  source 'http://rubygems.org'
72
4
 
73
- DATAMAPPER = 'git://github.com/datamapper'
74
- DM_VERSION = '~> 1.0.2'
75
-
76
- group :runtime do # Runtime dependencies (as in the gemspec)
77
-
78
- if ENV['EXTLIB']
79
- gem 'extlib', '~> 0.9.15', :git => "#{DATAMAPPER}/extlib.git"
80
- else
81
- gem 'activesupport', '~> 3.0.0', :git => 'git://github.com/rails/rails.git', :branch => '3-0-stable', :require => nil
82
- end
83
-
84
- gem 'dm-core', DM_VERSION, :git => "#{DATAMAPPER}/dm-core.git"
85
- gem 'dm-constraints', DM_VERSION, :git => "#{DATAMAPPER}/dm-constraints.git"
86
- gem 'dm-is-remixable', DM_VERSION, :git => "#{DATAMAPPER}/dm-is-remixable.git"
87
-
88
- end
5
+ SOURCE = ENV['SOURCE'] ? ENV['SOURCE'].to_sym : :git
6
+ REPO_POSTFIX = SOURCE == :path ? '' : '.git'
7
+ DATAMAPPER = SOURCE == :path ? Pathname(__FILE__).dirname.parent : 'http://github.com/datamapper'
8
+ DM_VERSION = '~> 1.1.0'
89
9
 
90
10
  group(:development) do # Development dependencies (as in the gemspec)
91
11
 
92
- gem 'rake', '~> 0.8.7'
93
- gem 'rspec', '~> 1.3', :git => 'git://github.com/snusnu/rspec', :branch => 'heckle_fix_plus_gemfile'
94
- gem 'jeweler', '~> 1.4'
12
+ gem 'rake', '~> 0.8.7'
13
+ gem 'rspec', '~> 2.4', :require => false
14
+ gem 'jeweler', '~> 1.5.2'
95
15
 
96
16
  end
97
17
 
98
18
  group :quality do # These gems contain rake tasks that check the quality of the source code
99
19
 
100
- gem 'metric_fu', '~> 1.3'
101
- gem 'rcov', '~> 0.9.8'
102
- gem 'reek', '~> 1.2.8'
103
- gem 'roodi', '~> 2.1'
20
+ gem 'rcov', '~> 0.9.7', :platforms => :mri_18
104
21
  gem 'yard', '~> 0.5'
105
22
  gem 'yardstick', '~> 0.1'
106
23
 
@@ -108,15 +25,17 @@ end
108
25
 
109
26
  group :datamapper do # We need this because we want to pin these dependencies to their git master sources
110
27
 
111
- adapters = ENV['ADAPTER'] || ENV['ADAPTERS']
112
- adapters = adapters.to_s.tr(',', ' ').split.uniq - %w[ in_memory ]
28
+ gem 'dm-taggings', '~> 1.0.0', :path => File.dirname(__FILE__) # Make ourself available to the adapters
29
+
30
+ adapters = ENV['ADAPTERS'] || ENV['ADAPTER'] || 'in_memory'
31
+ adapters = adapters.to_s.tr(',', ' ').split.uniq
113
32
 
114
33
  DO_VERSION = '~> 0.10.2'
115
34
  DM_DO_ADAPTERS = %w[ sqlite postgres mysql oracle sqlserver ]
116
35
 
117
36
  if (do_adapters = DM_DO_ADAPTERS & adapters).any?
118
37
  options = {}
119
- options[:git] = "#{DATAMAPPER}/do.git" if ENV['DO_GIT'] == 'true'
38
+ options[:git] = "#{DATAMAPPER}/do#{REPO_POSTFIX}" if ENV['DO_GIT'] == 'true'
120
39
 
121
40
  gem 'data_objects', DO_VERSION, options.dup
122
41
 
@@ -125,18 +44,24 @@ group :datamapper do # We need this because we want to pin these dependencies to
125
44
  gem "do_#{adapter}", DO_VERSION, options.dup
126
45
  end
127
46
 
128
- gem 'dm-do-adapter', DM_VERSION, :git => "#{DATAMAPPER}/dm-do-adapter.git"
47
+ gem 'dm-do-adapter', DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-do-adapter#{REPO_POSTFIX}"
129
48
  end
130
49
 
131
50
  adapters.each do |adapter|
132
- gem "dm-#{adapter}-adapter", DM_VERSION, :git => "#{DATAMAPPER}/dm-#{adapter}-adapter.git"
51
+ unless adapter == 'in_memory'
52
+ gem "dm-#{adapter}-adapter", DM_VERSION, SOURCE => "#{DATAMAPPER}/dm-#{adapter}-adapter#{REPO_POSTFIX}"
53
+ end
133
54
  end
134
55
 
135
56
  plugins = ENV['PLUGINS'] || ENV['PLUGIN']
136
- plugins = plugins.to_s.tr(',', ' ').split.push('dm-migrations').uniq
57
+ plugins = plugins.to_s.tr(',', ' ').split.push('dm-core').uniq
58
+
59
+ %w(dm-migrations dm-validations dm-constraints dm-is-remixable).each do |plugin|
60
+ plugins.push(plugin)
61
+ end
137
62
 
138
- plugins.each do |plugin|
139
- gem plugin, DM_VERSION, :git => "#{DATAMAPPER}/#{plugin}.git"
63
+ plugins.uniq.each do |plugin|
64
+ gem plugin, DM_VERSION, SOURCE => "#{DATAMAPPER}/#{plugin}#{REPO_POSTFIX}"
140
65
  end
141
66
 
142
67
  end
data/Rakefile CHANGED
@@ -10,26 +10,25 @@ end
10
10
 
11
11
  Bundler.require(:default, :development)
12
12
 
13
-
14
13
  begin
15
-
16
14
  require 'rake'
15
+
16
+ gem 'jeweler', '~> 1.5.2'
17
17
  require 'jeweler'
18
18
 
19
19
  Jeweler::Tasks.new do |gem|
20
20
 
21
21
  gem.name = 'dm-taggings'
22
22
  gem.summary = 'Tagging plugin for DataMapper'
23
- gem.description = 'DataMapper plugin that adds the possibility to tag models'
23
+ gem.description = 'DataMapper plugin providing taggable and tagger models'
24
24
  gem.email = 'piotr.solnica@gmail.com'
25
25
  gem.homepage = 'http://github.com/solnic/dm-taggings'
26
26
  gem.authors = [ 'Piotr Solnica' ]
27
27
 
28
- gem.add_dependency 'dm-core', '~> 1.0.2'
29
- gem.add_dependency 'dm-constraints', '~> 1.0.2'
30
- gem.add_dependency 'dm-is-remixable', '~> 1.0.2'
28
+ gem.add_dependency 'dm-constraints', '~> 1.1.0'
29
+ gem.add_dependency 'dm-is-remixable', '~> 1.1.0'
31
30
 
32
- gem.add_development_dependency 'rspec', '~> 1.3'
31
+ gem.add_development_dependency 'rspec', '~> 2.4'
33
32
  gem.add_development_dependency 'yard', '~> 0.5'
34
33
 
35
34
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.0
1
+ 1.0.0
@@ -1,88 +1,91 @@
1
1
  # Generated by jeweler
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{dm-taggings}
8
- s.version = "0.11.0"
8
+ s.version = "1.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Piotr Solnica"]
12
- s.date = %q{2010-10-14}
13
- s.description = %q{DataMapper plugin that adds the possibility to tag models}
12
+ s.date = %q{2011-03-17}
13
+ s.description = %q{DataMapper plugin providing taggable and tagger models}
14
14
  s.email = %q{piotr.solnica@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
- "README.rdoc",
18
- "TODO"
17
+ "README.rdoc",
18
+ "TODO"
19
19
  ]
20
20
  s.files = [
21
- ".gitignore",
22
- "Gemfile",
23
- "History.txt",
24
- "LICENSE",
25
- "Manifest.txt",
26
- "README.rdoc",
27
- "Rakefile",
28
- "TODO",
29
- "VERSION",
30
- "dm-taggings.gemspec",
31
- "lib/dm-taggings.rb",
32
- "lib/dm-taggings/is/tag.rb",
33
- "lib/dm-taggings/is/taggable.rb",
34
- "lib/dm-taggings/is/tagger.rb",
35
- "lib/dm-taggings/is/tagging.rb",
36
- "lib/dm-taggings/is/version.rb",
37
- "lib/dm-taggings/spec/taggable_shared_spec.rb",
38
- "lib/dm-taggings/spec/tagger_shared_spec.rb",
39
- "spec/fixtures/models.rb",
40
- "spec/integration/post_spec.rb",
41
- "spec/integration/tag_spec.rb",
42
- "spec/integration/taggable_spec.rb",
43
- "spec/integration/user_spec.rb",
44
- "spec/spec.opts",
45
- "spec/spec_helper.rb",
46
- "tasks/hoe.rb",
47
- "tasks/yard.rake",
48
- "tasks/yardstick.rake"
21
+ ".rspec",
22
+ "Gemfile",
23
+ "History.txt",
24
+ "LICENSE",
25
+ "Manifest.txt",
26
+ "README.rdoc",
27
+ "Rakefile",
28
+ "TODO",
29
+ "VERSION",
30
+ "dm-taggings.gemspec",
31
+ "lib/dm-taggings.rb",
32
+ "lib/dm-taggings/is/tag.rb",
33
+ "lib/dm-taggings/is/taggable.rb",
34
+ "lib/dm-taggings/is/tagger.rb",
35
+ "lib/dm-taggings/is/tagging.rb",
36
+ "lib/dm-taggings/is/version.rb",
37
+ "lib/dm-taggings/spec/taggable_shared_spec.rb",
38
+ "lib/dm-taggings/spec/tagger_shared_spec.rb",
39
+ "spec/fixtures/models.rb",
40
+ "spec/integration/post_spec.rb",
41
+ "spec/integration/tag_spec.rb",
42
+ "spec/integration/taggable_spec.rb",
43
+ "spec/integration/user_spec.rb",
44
+ "spec/spec_helper.rb",
45
+ "tasks/hoe.rb",
46
+ "tasks/yard.rake",
47
+ "tasks/yardstick.rake"
49
48
  ]
50
49
  s.homepage = %q{http://github.com/solnic/dm-taggings}
51
- s.rdoc_options = ["--charset=UTF-8"]
52
50
  s.require_paths = ["lib"]
53
- s.rubygems_version = %q{1.3.7}
51
+ s.rubygems_version = %q{1.6.2}
54
52
  s.summary = %q{Tagging plugin for DataMapper}
55
53
  s.test_files = [
54
+ "spec/fixtures/models.rb",
55
+ "spec/integration/post_spec.rb",
56
+ "spec/integration/tag_spec.rb",
56
57
  "spec/integration/taggable_spec.rb",
57
- "spec/integration/post_spec.rb",
58
- "spec/integration/tag_spec.rb",
59
- "spec/integration/user_spec.rb",
60
- "spec/fixtures/models.rb",
61
- "spec/spec_helper.rb"
58
+ "spec/integration/user_spec.rb",
59
+ "spec/spec_helper.rb"
62
60
  ]
63
61
 
64
62
  if s.respond_to? :specification_version then
65
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
66
63
  s.specification_version = 3
67
64
 
68
65
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
69
- s.add_runtime_dependency(%q<dm-core>, ["~> 1.0.2"])
70
- s.add_runtime_dependency(%q<dm-constraints>, ["~> 1.0.2"])
71
- s.add_runtime_dependency(%q<dm-is-remixable>, ["~> 1.0.2"])
72
- s.add_development_dependency(%q<rspec>, ["~> 1.3"])
66
+ s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
67
+ s.add_development_dependency(%q<rspec>, ["~> 2.4"])
68
+ s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
69
+ s.add_runtime_dependency(%q<dm-constraints>, ["~> 1.1.0"])
70
+ s.add_runtime_dependency(%q<dm-is-remixable>, ["~> 1.1.0"])
71
+ s.add_development_dependency(%q<rspec>, ["~> 2.4"])
73
72
  s.add_development_dependency(%q<yard>, ["~> 0.5"])
74
73
  else
75
- s.add_dependency(%q<dm-core>, ["~> 1.0.2"])
76
- s.add_dependency(%q<dm-constraints>, ["~> 1.0.2"])
77
- s.add_dependency(%q<dm-is-remixable>, ["~> 1.0.2"])
78
- s.add_dependency(%q<rspec>, ["~> 1.3"])
74
+ s.add_dependency(%q<rake>, ["~> 0.8.7"])
75
+ s.add_dependency(%q<rspec>, ["~> 2.4"])
76
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
77
+ s.add_dependency(%q<dm-constraints>, ["~> 1.1.0"])
78
+ s.add_dependency(%q<dm-is-remixable>, ["~> 1.1.0"])
79
+ s.add_dependency(%q<rspec>, ["~> 2.4"])
79
80
  s.add_dependency(%q<yard>, ["~> 0.5"])
80
81
  end
81
82
  else
82
- s.add_dependency(%q<dm-core>, ["~> 1.0.2"])
83
- s.add_dependency(%q<dm-constraints>, ["~> 1.0.2"])
84
- s.add_dependency(%q<dm-is-remixable>, ["~> 1.0.2"])
85
- s.add_dependency(%q<rspec>, ["~> 1.3"])
83
+ s.add_dependency(%q<rake>, ["~> 0.8.7"])
84
+ s.add_dependency(%q<rspec>, ["~> 2.4"])
85
+ s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
86
+ s.add_dependency(%q<dm-constraints>, ["~> 1.1.0"])
87
+ s.add_dependency(%q<dm-is-remixable>, ["~> 1.1.0"])
88
+ s.add_dependency(%q<rspec>, ["~> 2.4"])
86
89
  s.add_dependency(%q<yard>, ["~> 0.5"])
87
90
  end
88
91
  end
@@ -7,12 +7,12 @@ require 'dm-is-remixable'
7
7
 
8
8
  # Require plugin-files
9
9
 
10
- dir = Pathname(__FILE__).dirname.expand_path / 'dm-taggings' / 'is'
10
+ dir = File.dirname(__FILE__) + '/dm-taggings/is/'
11
11
 
12
- require dir / 'taggable.rb'
13
- require dir / 'tag.rb'
14
- require dir / 'tagging.rb'
15
- require dir / 'tagger.rb'
12
+ require dir + 'taggable.rb'
13
+ require dir + 'tag.rb'
14
+ require dir + 'tagging.rb'
15
+ require dir + 'tagger.rb'
16
16
 
17
17
  # Include the plugin in Resource
18
18
  DataMapper::Model.append_extensions DataMapper::Is::Taggable
@@ -31,39 +31,46 @@ module DataMapper
31
31
 
32
32
  class << self
33
33
  attr_reader :tagging_parent_name, :tagging_relationship_name, :tagging_relationship,
34
- :tagging_class, :taggable_relationship_name
34
+ :tagging_class, :taggable_relationship_name, :taggable_options
35
35
  end
36
36
 
37
+ # set up options hash
38
+ @taggable_options = {}
39
+ @taggable_options[:tag_list_separator] = options.fetch(:tag_list_separator, ',')
40
+
37
41
  # Make the magic happen
38
42
  options[:by] ||= []
39
43
 
40
- remix n, :taggings
44
+ remix n, :taggings, :constraint => :destroy!
45
+
46
+ inflector = DataMapper::Inflector
41
47
 
42
- @tagging_parent_name = DataMapper::Inflector.underscore(name).to_sym
48
+ @tagging_parent_name = inflector.underscore(inflector.demodulize(name)).to_sym
43
49
  @tagging_relationship_name = "#{@tagging_parent_name}_tags".to_sym
44
50
  @tagging_relationship = relationships[@tagging_relationship_name]
45
51
  @tagging_class = @tagging_relationship.child_model
46
52
 
47
- @taggable_relationship_name = DataMapper::Inflector.underscore(name).pluralize.to_sym
53
+ @taggable_relationship_name = inflector.pluralize(inflector.underscore(inflector.demodulize(name))).to_sym
48
54
 
49
55
  @tagging_relationship.add_constraint_option(
50
56
  @taggable_relationship_name, @tagging_class, self, :constraint => :destroy!)
51
57
 
52
58
  tagging_parent_name = @tagging_parent_name
59
+ model_name = name
53
60
 
54
61
  enhance :taggings do
55
62
  belongs_to :tag
56
- belongs_to tagging_parent_name
63
+ belongs_to tagging_parent_name, model_name
57
64
 
58
65
  options[:by].each do |tagger_class|
59
- belongs_to DataMapper::Inflector.underscore(tagger_class.name), :required => false
66
+ belongs_to inflector.underscore(inflector.demodulize(tagger_class.name)), tagger_class.name, :required => false
60
67
  end
61
68
  end
62
69
 
63
- has n, :tags, :through => @tagging_relationship_name, :constraint => :destroy!
70
+ has n, :tags, :through => @tagging_relationship_name
64
71
 
65
- Tag.has n, @tagging_relationship_name, :constraint => :destroy!
66
- Tag.has n, @taggable_relationship_name, :through => @tagging_relationship_name
72
+ Tag.has n, @tagging_relationship_name, :model => tagging_class, :constraint => :destroy!
73
+ Tag.has n, @taggable_relationship_name, :model => name, :through => @tagging_relationship_name
67
74
 
68
75
  options[:by].each do |tagger_class|
69
76
  tagger_class.is :tagger, :for => [self]
@@ -119,14 +126,8 @@ module DataMapper
119
126
  #
120
127
  # @api public
121
128
  def tag(tags_or_names)
122
- tags = extract_tags_from_names(tags_or_names)
123
-
124
- tags.each do |tag|
125
- next if self.tags.include?(tag)
126
- taggings.new(:tag => tag)
127
- end
128
-
129
- taggings
129
+ tags_to_add = extract_tags_from_names(tags_or_names) - tags
130
+ tags.push(*tags_to_add)
130
131
  end
131
132
 
132
133
  # Add tags to a resource and persists them.
@@ -139,9 +140,9 @@ module DataMapper
139
140
  #
140
141
  # @api public
141
142
  def tag!(tags_or_names)
142
- taggings = tag(tags_or_names)
143
- taggings.save! unless new?
144
- taggings
143
+ added_tags = tag(tags_or_names)
144
+ save unless new?
145
+ added_tags
145
146
  end
146
147
 
147
148
  # Delete given tags from a resource collection without actually deleting
@@ -155,17 +156,13 @@ module DataMapper
155
156
  #
156
157
  # @api public
157
158
  def untag(tags_or_names=nil)
158
- tags = extract_tags_from_names(tags_or_names) if tags_or_names
159
-
160
- taggings_to_destroy = if tags.blank?
161
- taggings.all
159
+ tags_to_remove = if tags_or_names
160
+ extract_tags_from_names(tags_or_names)
162
161
  else
163
- taggings.all(:tag => tags)
162
+ tags.dup
164
163
  end
165
164
 
166
- self.taggings = taggings - taggings_to_destroy
167
-
168
- taggings_to_destroy
165
+ tags_to_remove.each { |tag| tags.delete(tag) }
169
166
  end
170
167
 
171
168
  # Same as untag but actually delete the tags from the datastore.
@@ -178,9 +175,9 @@ module DataMapper
178
175
  #
179
176
  # @api public
180
177
  def untag!(tags_or_names=nil)
181
- taggings_to_destroy = untag(tags_or_names)
182
- taggings_to_destroy.destroy! unless new?
183
- taggings_to_destroy
178
+ removed_tags = untag(tags_or_names)
179
+ save unless new?
180
+ removed_tags
184
181
  end
185
182
 
186
183
  # Return a string representation of tags collection
@@ -190,7 +187,7 @@ module DataMapper
190
187
  #
191
188
  # @api public
192
189
  def tag_list
193
- @tag_list ||= tags.collect { |tag| tag.name }.join(", ")
190
+ @tag_list ||= tags.collect { |tag| tag.name }.join("#{self.class.taggable_options[:tag_list_separator]} ")
194
191
  end
195
192
 
196
193
  # Tag a resource using tag names from the give list separated by commas.
@@ -200,14 +197,19 @@ module DataMapper
200
197
  #
201
198
  # @return [DataMapper::Associations::OneToMany::Collection]
202
199
  # A DataMapper collection of resource's tags
200
+ #
201
+ # @api public
203
202
  def tag_list=(list)
204
203
  @tag_list = list
205
204
 
206
- tag_names = list.split(",").map { |name| name.blank? ? nil : name.strip }.compact
205
+ tag_names = list.split(self.class.taggable_options[:tag_list_separator]).map do |name|
206
+ name.strip!
207
+ name.size == 0 ? nil : name
208
+ end.compact
207
209
 
208
- old_tag_names = taggings.map { |tagging| tagging.tag.name } - tag_names
210
+ old_tag_names = tags.map { |tag| tag.name } - tag_names
209
211
 
210
- untag!(old_tag_names)
212
+ untag(old_tag_names)
211
213
  tag(tag_names)
212
214
  end
213
215