anchor.diff:  
       $("#myCategories .tagit-choice").each(function(index,elem){
         //comprobar primero los que tengan un attrvalue null para crearlos
  +      if ($(elem).attr("tagvalue") != null){
  +        cat_done_array.push({id: $(elem).attr("tagvalue")});
  +      }
  +      else {
           cat_done_array.push({title: $(elem).text()});
  +      }
       });
   
       $.ajax({
  
positive.code:   .to_s%>", category_array: JSON.stringify(cat_done_array) },
                success: function(data){    
                  $("#categories_viewer_modal").modal('toggle');
                  alert("<%=t('category.success')%>");
                  location.reload();
                  }
      });
    });
  
  
negative.code:         <% generic_categories = Category.authored_by(current_subject).sort_by!{|e| e.title.downcase} %>
          <p class= "information"><%= t("category.cat_add_title")%></p> 
          
          <!-- Juancar echalé un ojo-->
         <div class="dropdown">
            <button class="btn btn-default dropdown-toggle" type="button" id="dropdownMenu1" data-toggle="dropdown">
              <b><%= t("category.cat_add_select")%></b>
              <span class="caret"></span>
            </button>
              <ul id="catDropdownSel" class="dropdown-menu scroll-menu" role="menu" aria-labelledby="dropdownMenu1">
              <% generic_categories.each do |init| %> 
  
              <li role="presentation" value="<%=init.id%>"><a role="menuitem" tabindex="-1" ><%=init.title%></a></li>
              
              <% end %>
            </ul>
          </div>
  
           <!--<p class= "information"><%= t("category.cat_popular")%></p>-->
           <br>
           <div id="suggested_categories" class="tagBoxNew">
              <% rcCategories = generic_categories.reject{|e| get_initial_categories(item).include? e.id} %> 
              <%simple_gen = rcCategories.sort{|a,b| b.property_objects.length <=> a.property_objects.length}.first(7)%>
              <% simple_gen.each do |init| %> 
                <ul id="suggestedCategories" class="tagit">
                  <li class="tagit-choice" value="<%= init.id %>" ><%=init.title%></li>
                </ul>
              <% end %>
           </div>
  
          <p class="information"><%= t("category.categorized_like")%></p>
          <%tagArray= generic_categories.map{|e| e.title}%>
          <script type="text/javascript">
          $(document).ready(function() {
              var tagList= [
                <%tagArray.each do |tags|%>
                  "<%=tags%>",
                <%end%>
              ];
              $("#myCategories").tagit({
                watermarkAllowMessage: "<%= t('category.tagit_watermark_cat')%>",
                tagSource: tagList
              });
              <% resource_categories = get_initial_categories(item) %>
                <% resource_categories.each do |cat| %>
                  <% ident = Category.find(cat) %>
                  $("#myCategories").tagit("add", "<%=ident.title %>", "<%=ident.id%>");
              <%end%> 
              //Save suggested categories state
  
          });
          </script>
          <div class="tagBoxNew">
            <ul id="myCategories">
          <!-- Existing list items will be pre-added to the tags -->
              
            </ul>
          </div>
  
        </div>
        <div class="modal-footer">
  