<div class="btn-group">
  <%= link_to "Todas turmas", teams_path, remote: true,
                              id: "all-teams", class: "btn btn-default active" %>
  <%= link_to "Minhas turmas", teams_path(my_teams: true), remote: true,
                              id: "my-teams", class: "btn btn-default" %>
</div>

<% if can? :create, @team %>
  <%=link_to "Criar nova turma", new_team_path(@team),
                                  class: "btn btn-primary pull-right" %>
<% end %>

<br></br>

<div id="teams">
  <%= render 'teams' %>
</div>

<%= render "shared/paginate", object: @teams %>

<script type="text/javascript">
  $(document).ready(function() {
    $('#all-teams').click(function() {
      $('#my-teams').removeClass('active');
      $(this).addClass('active');
    });

    $('#my-teams').click(function() {
      $('#all-teams').removeClass('active');
      $(this).addClass('active');
    });
  });
</script>

<div class="btn-group">
  <%= link_to "Todas turmas", teams_path, remote: true,
                              id: "all-teams", class: "btn btn-default active" %>
  <%= link_to "Minhas turmas", teams_path(my_teams: true), remote: true,
                              id: "my-teams", class: "btn btn-default" %>
</div>

<% if can? :create, Team %>
  <%=link_to "Criar nova turma", new_team_path(@team),
                                  class: "btn btn-primary pull-right" %>
<% end %>

<br></br>

<div id="teams">
  <%= render 'teams' %>
</div>

<%= render "shared/paginate", object: @teams %>

<script type="text/javascript">
  $(document).ready(function() {
    $('#all-teams').click(function() {
      $('#my-teams').removeClass('active');
      $(this).addClass('active');
    });

    $('#my-teams').click(function() {
      $('#all-teams').removeClass('active');
      $(this).addClass('active');
    });
  });
</script>

Fix autorization to create Team in Team index view
Fix autorization to create Team in Team index view
