| Class | Admin::TagsController |
| In: |
app/controllers/admin/tags_controller.rb
|
| Parent: | Admin::BaseController |
# File app/controllers/admin/tags_controller.rb, line 29
29: def find_duplicates
30: @duplicated_tags = Tag.duplicated_tags
31: end
# File app/controllers/admin/tags_controller.rb, line 7
7: def index
8: @title = 'Tags'
9: @tags = Tag.public.find(:all, :order => "tildes(lower(name_es))")
10: end
# File app/controllers/admin/tags_controller.rb, line 33
33: def merge
34: if params[:cancel]
35: flash[:notice] = "Los tags se han dejado como estaban"
36:
37: else
38: @duplicated_tags = Tag.duplicated_tags
39:
40: @duplicated_tags.group_by(&:name_es).each do |group_name, tags|
41: reference_tag = tags.first
42: duplicated_tags = tags - [tags.first]
43: duplicated_tags.each do |tag|
44: Tagging.update_all("tag_id=#{reference_tag.id}", "tag_id=#{tag.id}")
45: Tag.find(tag.id).destroy
46: end
47: end
48: flash[:notice] = "Los tags se han agrupado"
49: end
50: redirect_to admin_tags_path
51: end