title: Rails - "Filter chain halted as :authorize rendered or redirected" when I execute extended function
body: <p>I'm trying to extend the repository controller with a new function following this article:
  <a href="http://www.redmine.org/projects/redmine/wiki/Plugin_Internals" rel="nofollow">http://www.redmine.org/projects/redmine/wiki/Plugin_Internals</a></p>
  
  <p>All seems to work right, but when I click on the button which call my extended function I get this error:</p>
  
  <p><strong>Filter chain halted as :authorize rendered or redirected
  Completed 403 Forbidden in 5ms (ActiveRecord: 2.0ms)</strong></p>
  
  <p>Following my related codes.</p>
  
  <p>client.rb created in lib/client</p>
  
  <pre><code>require_dependency 'repositories_controller'
  
  module RepositoriesPatch
      def self.included(base)
  
        base.send(:include, InstanceMethods)
      end
  
      module InstanceMethods
          def exec_client
            [...]
          end
      end
  end
  
  Repository.send(:include, RepositoriesPatch)
  </code></pre>
  
  <p>init.rb</p>
  
  <pre><code>#encoding: utf-8
  
  require_dependency 'client/client'
  
  Redmine::Plugin.register :gerar_versao_projeto do
    name 'Gerar Versão Projeto'
    [...]
  
    project_module :repository do
       permission :view_repository, :repository =&gt; :exec_client
    end
  
    Rails.configuration.to_prepare do 
     RepositoriesController.send(:include, RepositoriesPatch)
    end
  end
  </code></pre>
  
  <p>routes.rb</p>
  
  <pre><code>match '/projects/:id/repository', :action =&gt; 'exec_client', :controller =&gt; 'repositories', :via =&gt; :post
  </code></pre>
  
  <p>In my view I call the function exec_client as listed below:</p>
  
  <pre><code>&lt;%= button_to_function l(:gerar_build_project), remote_function(:action =&gt; 'exec_client', :controller =&gt; 'repositories')%&gt;
  </code></pre>
  
  <p>If someone interest, below is the complete log error:</p>
  
  <pre><code>Started POST "/projects/teste1/repository" for 127.0.0.1 at 2013-07-19 16:51:53 -0300
  Processing by RepositoriesController#exec_client as JS
    Parameters: {"authenticity_token"=&gt;"9JifnciRmiVCbf5uFWWGmSeePp4m0IM74UR10kGemHA=", "id"=&gt;"teste1"}
    ←[1m←[35m (0.0ms)←[0m  SELECT MAX(`settings`.`updated_on`) AS max_id FROM `settings`
    ←[1m←[36mUser Load (0.0ms)←[0m  ←[1mSELECT `users`.* FROM `users` WHERE `users`.`type` IN ('User', 'AnonymousUser') AND `users`.`id` = 1 AND (us
  ers.status = 1) LIMIT 1←[0m
    ←[1m←[35mProject Load (0.0ms)←[0m  SELECT `projects`.* FROM `projects` WHERE `projects`.`identifier` = 'teste1' LIMIT 1
    ←[1m←[36mRepository Load (0.0ms)←[0m  ←[1mSELECT `repositories`.* FROM `repositories` WHERE `repositories`.`project_id` = 1 AND (is_default = 1)
   LIMIT 1←[0m
    ←[1m←[35mEnabledModule Load (0.0ms)←[0m  SELECT name FROM `enabled_modules` WHERE `enabled_modules`.`project_id` = 1
  Filter chain halted as :authorize rendered or redirected
  Completed 403 Forbidden in 6ms (ActiveRecord: 0.0ms)
  </code></pre>
  
  <p>What's going wrong?</p>