custom RESTful action links in 3.1.2

27 views
Skip to first unread message

Ryan Moats

unread,
Sep 27, 2011, 1:47:07 PM9/27/11
to ActiveScaffold : Ruby on Rails plugin
Has anybody managed to get custom RESTful actions working with the
active_scaffold 3.1.2 gem?

I've done the following:
-added the custom action that I want to use to the routing table via
resources :worlds do
get 'finish', :on => :member
as_routes
end
-confirmed the URL and HTTP verb with rake routes
finish_worlds GET /worlds/:id/finish(.:format)
{:action=>"finish", :controller=>"worlds}

-added the necessary methods to the controller module
-verified that the methods are reached if I put in the proper URL to
a browser window
(in this case /worlds/1/finish)

But, as soon as I add the method with config.action_links.add, I get a
routing error when trying to go to /worlds

the controller module looks like:
Class WorldController < ApplicationController
active_scaffold :world do |conf|
conf.action_links.add 'finish'
end

def finish
end
end

leads to
No route matches {:controller=>"worlds", :action=>"finish"}

when trying to render the group action links in line 19 of
_action_group.html.erb

Any ideas? Thanks in advance
Ryan Moats

clyfe

unread,
Sep 27, 2011, 2:19:08 PM9/27/11
to actives...@googlegroups.com
Does this help ? :

conf.action_links.add 'finish' , :type => :member

Ryan Moats

unread,
Sep 27, 2011, 2:32:50 PM9/27/11
to actives...@googlegroups.com

Yes, that does the trick. I'd looked at that page a couple of times
but didn't tumble to that being there.

Many thanks...
Ryan

Reply all
Reply to author
Forward
0 new messages