Acts_as_taggable issue

This won’t post with a full code paste, so I’ve got to link it to
another forum where I’ve posted it.

Can’t get the acts_as_taggable plugin to play nice. Works in console,
not in teh view.

On Dec 26, 2006, at 11:03 PM, boboroshi wrote:

This won’t post with a full code paste, so I’ve got to link it to
another forum where I’ve posted it.

http://www.railsweenie.com/forums/1/topics/1053

Can’t get the acts_as_taggable plugin to play nice. Works in console,
not in teh view.

You’re not showing your routes.rb, so I can’t be sure, but it looks
like you need to setup a route for this…

= in config/routes.rb

map.connect ‘/elements/tagged/:tag_name’, :controller =>
‘elements’, :action => ‘tagged’

= end

Alternatively, you could use params[:id] instead of params[:tag_name]
in line 4 of your controller, but changing the route will make it
clearer that you’re not expecting a numeric id there.

-JD Harrington

Thanks JD. I actually do have this, but I don’t call the controller

map.connect ‘:controller/tagged/:tag_name’, :action => :tagged

Also, this could cause a lot of issue - I’m using RC1 for 1.2 and
everything is restful.

So in trying to go for semantic urls, is

http://tld.com/elements/tagged/tag_name

not a good way to go? Here is the full routes file with all comments
removed:

ActionController::Routing::Routes.draw do |map|
map.resources :element_types
map.resources :elements

map.connect ‘:controller/tagged/:tag_name’, :action => :tagged

map.connect ‘’, :controller => “element”

map.connect ‘:controller/service.wsdl’, :action => ‘wsdl’

map.connect ‘:controller/:action/:id.:format’
map.connect ‘:controller/:action/:id’
end

I appreciate the help,
John

AH! using the symbol for :tagged in the routes breaks it. Not sure why.
But it does. Changing the route to

map.connect ‘:controller/tagged/:tag_name’, :action => ‘tagged’

made it work

On Dec 27, 2006, at 12:45 PM, boboroshi wrote:

AH! using the symbol for :tagged in the routes breaks it. Not sure
why.
But it does. Changing the route to

map.connect ‘:controller/tagged/:tag_name’, :action => ‘tagged’

made it work

Interesting. Glad it’s working for you now.

-JD