ActionController::UnknownAction

Hi

I m new to RoR. I added a method to an already existing controller.
i am calling that method from a view (roadmap).
I also added following code in route.rb

project_actions.connect ‘projects/draganddropsort’, :action =>
‘draganddropsort’

portionwhere i call my function
<%= sortable_element ‘issue-list’,
:url => {:action => :draganddropsort, :issue_list => issues },
:complete => visual_effect(:highlight, ‘issue-list’),
:tag => ‘tr’
%>


And im getting the
following error;

Processing ProjectsController#draganddropsort (for 127.0.0.1 at
2011-01-12 16:03:20) [POST]
Parameters: {“issue_list”=>[“1477”, “1478”],
“action”=>“draganddropsort”, “authenticity_token”=>"…=",
“id”=>"*********", “issue-list”=>[“1478”, “1477”],
“controller”=>“projects”}

ActionController::UnknownAction (No action responded to draganddropsort.
Actions: accept_key_auth_actions, activity, add, add_file, api_request?,
archive, authorize, authorize_global, bazaar_field_tags,
check_if_login_required, check_project_privacy, column_content,
column_header, copy, current_language, current_menu_item,
custom_field_formats_for_select, custom_field_label_tag,
custom_field_tag, custom_field_tag_for_bulk_edit,
custom_field_tag_with_label, custom_fields_tabs, cvs_field_tags,
darcs_field_tags, day_name, default_search_scope, default_search_scopes,
delete_broken_cookies, deny_access, destroy, edit,
filename_for_content_disposition, filesystem_field_tags,
find_current_user, find_language, find_model_object, find_project,
find_project_from_association, format_date, format_revision,
format_time, format_value, format_version_sharing, git_field_tags,
index, invalid_authenticity_token, l_hours, l_or_humanize,
link_to_version, list_files, ll, logged_user=, menu_items,
mercurial_field_tags, modules, month_name, object_errors_to_json,
operators_for_select, parent_project_select_tag, parse_qvalues,
per_page_option, project_settings_tabs, query_statement_invalid,
redirect_back_or_default, redirect_to_project_menu_item, render_403,
render_404, render_attachment_warning_if_needed, render_changes_tree,
render_changeset_changes, render_error, render_feed,
render_project_hierarchy, render_properties, repository_field_tags,
require_admin, require_login, reset_activities, retrieve_query, roadmap,
save_activities, scm_select_tag, set_language_if_valid,
set_localization, settings, show, show_value, sort_clause, sort_clear,
sort_header_tag, sort_init, sort_link, sort_name, sort_update,
subversion_field_tags, to_utf8, truncate_at_line_break, unarchive,
user_setup, valid_languages, version_options_for_select,
with_leading_slash, and without_leading_slash):
/usr/lib/ruby/1.8/action_controller/filters.rb:617:in call_filters' /usr/lib/ruby/1.8/action_controller/filters.rb:610:inperform_action_without_benchmark’
/usr/lib/ruby/1.8/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' /usr/lib/ruby/1.8/action_controller/benchmarking.rb:68:inperform_action_without_rescue’
/usr/lib/ruby/1.8/action_controller/rescue.rb:160:in
perform_action_without_flash' /usr/lib/ruby/1.8/action_controller/flash.rb:146:inperform_action’
/usr/lib/ruby/1.8/action_controller/base.rb:532:in send' /usr/lib/ruby/1.8/action_controller/base.rb:532:inprocess_without_filters’
/usr/lib/ruby/1.8/action_controller/filters.rb:606:in process' /usr/lib/ruby/1.8/action_controller/base.rb:391:inprocess’
/usr/lib/ruby/1.8/action_controller/base.rb:386:in call' /usr/lib/ruby/1.8/action_controller/routing/route_set.rb:437:incall’
/usr/lib/ruby/1.8/action_controller/dispatcher.rb:87:in `dispatch’

Kindly help me out …

Thanks in advance
Anju

Do you have that same method in yours projects controller ?

On Wed, Jan 12, 2011 at 4:14 PM, Anju P s [email protected] wrote:

<%= sortable_element ‘issue-list’,
2011-01-12 16:03:20) [POST]
column_header, copy, current_language, current_menu_item,
link_to_version, list_files, ll, logged_user=, menu_items,
sort_header_tag, sort_init, sort_link, sort_name, sort_update,
/usr/lib/ruby/1.8/action_controller/rescue.rb:160:in

You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to

[email protected][email protected]

.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Thanks:
Rajeev sharma

yes . i have same method in projects_controller.rb

def draganddropsort

end

Kannav R. wrote in post #974224:

Do you have that same method in yours projects controller ?

On Wed, Jan 12, 2011 at 4:14 PM, Anju P s [email protected] wrote:

<%= sortable_element ‘issue-list’,
2011-01-12 16:03:20) [POST]
column_header, copy, current_language, current_menu_item,
link_to_version, list_files, ll, logged_user=, menu_items,
sort_header_tag, sort_init, sort_link, sort_name, sort_update,
/usr/lib/ruby/1.8/action_controller/rescue.rb:160:in

You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to

[email protected][email protected]

.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Thanks:
Rajeev sharma

On Jan 12, 11:37am, Anju P s [email protected] wrote:

yes . i have same method in projects_controller.rb

And it’s public?

Fred

Frederick C. wrote in post #974232:

On Jan 12, 11:37am, Anju P s [email protected] wrote:

yes . i have same method in projects_controller.rb

And it’s public?

Fred

I hope by default its public…

Anju

The only suggestion I can think of is to check there’s no private or
protected call on any of the lines above the method name or to check the
routes file:

project_actions.connect ‘projects/draganddropsort’, :action
=> ‘draganddropsort’

Where is the project_actions coming from ? is it a block variable for
map.resources :projects do |project_actions| ?

David

David W. wrote in post #974243:

The only suggestion I can think of is to check there’s no private or
protected call on any of the lines above the method name or to check the
routes file:

project_actions.connect ‘projects/draganddropsort’, :action
=> ‘draganddropsort’

Where is the project_actions coming from ? is it a block variable for
map.resources :projects do |project_actions| ?

David

projects.with_options :conditions => {:method => :post} do
|project_actions|

Even i think some mistake in routing …i did some workaround on
it…but all in vain :(.
I call draganddropsort method from roadmap view…and its route is been
added like

map.with_options :controller => ‘projects’ do |projects|
projects.with_options :conditions => {:method => :get} do
|project_views|

project_views.connect ‘projects/:id/:action’, :action => ‘roadmap’

end
Can anyone suggest possible routes that i can add.

Thanks
anju

Maybe just keep it very simple with:

map.connect ‘projects/draganddropsort’, :controller => ‘projects’,
:action
=> ‘draganddropsort’

And just see if you can access the draganddropsort method by navigating
to
it in your browser. Also might be worth running rake routes to see what
routes are getting set.

David

when i tried
'http://127.0.0.1:3000/projects/1-strfronttech-011/draganddropsort’in
browser, i got
Unknown action

Anju

David W. wrote in post #974269:

Whats 1-strfronttech-011 ?

If you’re passing parameters in the url then you’ll need to show that in
the
routes sometihng like.

map.connect 'projects/:your_parameter/draganddropsort, :controller =>
'projects, :action => ‘draganddropsort’

You can access that parameter in your controller with
params[:your_parameter]

David

yes i did map.connect ‘projects/:id/draganddropsort’, :controller =>
‘projects’, :action => ‘draganddropsort’ in route.rb…

Could you post your projects controller? Might be able to see if there’s
something wrong in there.

David

Whats 1-strfronttech-011 ?

If you’re passing parameters in the url then you’ll need to show that in
the
routes sometihng like.

map.connect 'projects/:your_parameter/draganddropsort, :controller =>
'projects, :action => ‘draganddropsort’

You can access that parameter in your controller with
params[:your_parameter]

David

I resolved the issue
It was a PEBKAC, accidentally I defined my method under a set of private
methods :(.

Thanks David

David W. wrote in post #974243:

The only suggestion I can think of is to check there’s no private or
protected call on any of the lines above the method name or to check the
routes file:

project_actions.connect ‘projects/draganddropsort’, :action
=> ‘draganddropsort’

Where is the project_actions coming from ? is it a block variable for
map.resources :projects do |project_actions| ?

David

David W. wrote in post #974274:

Could you post your projects controller? Might be able to see if there’s
something wrong in there.

David

Here is my projects_controller.rb…

class ProjectsController < ApplicationController
menu_item :overview
menu_item :activity, :only => :activity
menu_item :roadmap, :only => [:roadmap]
menu_item :files, :only => [:list_files, :add_file]
menu_item :settings, :only => :settings

before_filter :find_project, :except => [ :index, :list, :add, :copy,
:activity,:draganddropsort ]
before_filter :find_optional_project, :only => :activity
before_filter :authorize, :except => [ :index, :list, :add, :copy,
:archive, :unarchive, :destroy, :activity,:draganddropsort ]
before_filter :authorize_global, :only => :add
before_filter :require_admin, :only => [ :copy, :archive, :unarchive,
:destroy ]
accept_key_auth :activity, :index

after_filter :only => [:add, :edit, :archive, :unarchive, :destroy] do
|controller|
if controller.request.post?
controller.send :expire_action, :controller => ‘welcome’, :action
=> ‘robots.txt’
end
end

helper :sort
include SortHelper
helper :custom_fields
include CustomFieldsHelper
helper :issues
helper :queries
include QueriesHelper
helper :repositories
include RepositoriesHelper
include ProjectsHelper

Lists visible projects

def index

end

Add a new project

def add

end


def draganddropsort
#@issue = Issue.find_by_id(params[“1479”])
@issues = Issue.find(params[:issue_list])
@issues.each do |issue|
#issue.custom_field_values.value = params[‘issue-list’
].index(issue.id.to_s) + 1
issue.subject = “test”
issue.save
end
render :nothing => true
end

end

Thanks
Anju