Module: Mongoid::Taggable

Extended by:
ActiveSupport::Concern
Defined in:
lib/mongoid/taggable.rb

Overview

Copyright © 2010 Wilker Lúcio <[email protected]>

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#save_tags_index!Object



121
122
123
# File 'lib/mongoid/taggable.rb', line 121

def save_tags_index!
  self.class.save_tags_index!
end

#tagsObject



109
110
111
# File 'lib/mongoid/taggable.rb', line 109

def tags
  (tags_array || []).join(self.class.tags_separator)
end

#tags=(tags) ⇒ Object



113
114
115
116
117
118
119
# File 'lib/mongoid/taggable.rb', line 113

def tags=(tags)
  if tags.present?
    self.tags_array = tags.split(self.class.tags_separator).map(&:strip).reject(&:blank?)
  else
   self.tags_array = []
  end
end