Project

General

Profile

Unable to reach custom Issues method

Added by Heavy Dev about 13 years ago

i am having trouble reaching a custom method which i have patched into the IssuesController. my log error reads:

Processing IssuesController#myCustom [POST]
Parameters: {"commit"=>"Submit", "action"=>"myCustom", "authenticity_token"=>"theToken", "id"=>"12345", "controller"=>"issues", "text_i_am_posting"=>"there is text here"}
Filter chain halted as [:authorize] rendered_or_redirected.
Completed in 5ms (View: 1, DB: 1) | 403 Forbidden [SERVER/issues/myCustom/12345]

the relevant method in my issue patch (vendor/plugins/redmine_my_plugin/lib/issue_patch.rb)

def myCustom
  logger.info 'write into the log'
  # some logic happens here
end

besides the error referenced above, i never receive a log message that the method was reached.

i am trying to reach this method from a view (vendor/plugins/redmine_my_plugin/app/views/issues/_myCustom.rhtml)

<% remote_form_for(:issue, @issue,
              :url => {:controller => 'issues', :action => 'myCustom', :id => @issue},
              :method => :post,
              :html => {:id => 'new-myCustom', :style => (@cus_val ? '' : 'display: none;')}) do |f| %>
<%= render :partial => 'myCustom_edit.rhtml', :local => {:f => f} %>
<% end %>

i have additional non-routable edits to the issues patch that are successfully processed by redmine. it seems (to me) that my problem is in routing to the myCustom method/URL.

i am also uncertain as to why [:authorize] is sending the redirect/render error. i have tried some various ways to bypass :authorize (such as before_filter :authorize, :except => [:myCustom] but without success).

any help would be much appreciated.

i am currently running under Webrick

script/about
About your application's environment
Ruby version 1.8.7 (i686-linux)
RubyGems version 1.4.1
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /path/to/my/redmine
Environment production
Database adapter mysql
Database schema version 20110131014709

About your Redmine plugins
Redmine First plugin 0.0.1
Redmine myCustom plugin 0.0.1
Redmine Third plugin 0.0.1


Replies (4)

RE: Unable to reach custom Issues method - Added by Etienne Massip about 13 years ago

try :partial => 'issues/myCustom_edit'

RE: Unable to reach custom Issues method - Added by Heavy Dev about 13 years ago

so, my problem is not in the rendering of myCustom_edit.rhtml. that renders perfectly well.

when myCustom_edit.rhtml (a form) submits to /issues/myCustom/12345 is where i have a problem. i do not seem to be reaching the myCustom method.

RE: Unable to reach custom Issues method - Added by Etienne Massip about 13 years ago

Did you add some route to config/routes.rb ?

RE: Unable to reach custom Issues method - Added by Heavy Dev about 13 years ago

ya, in vendor/plugins/redmine_my_custom/config/routes.rb :

ActionController::Routing::Routes.draw do |map|
  map.resource :myCustom
  map.connect '/issues/myCustom/:id', :controller => 'issues', :action => 'myCustom', :conditions => {:method => :post}
end

rake routes shows:

 POST   /issues/myCustom/:id   {:action=>"myCustom", :controller=>"issues"}
    (1-4/4)