I am using acts_as_taggable according to the examples in the Rails Recipes book. Everything works fine except for cases where I want to use a tag with a dot (like .NET) or a slash (like COM/OLE). The problem is not really with acts_as_taggable, but rather with routing. I am using the suggested technique where I use urls like /kb/list/ mytag to display all the entries tagged "mytag." Here is the console output showing what happens when I use urls with dots or slashes: This works as expected:>> rs.recognize_path "/kb/list/mytag"=> {:id=>"mytag", :action=>"list", :controller=>"kb"} But check these out:>> rs.recognize_path "/kb/list/.NET"=> {:anything=>["kb", "list", ".NET"], :controller=>"kb", :action=>"index"}>> rs.recognize_path "/kb/list/COM%2FOLE"=> {:anything=>["kb", "list", "COM", "OLE"], :controller=>"kb", :action=>"index" } Note that I replaced "/" with "%2F" because that''s what happens in the browser when it urlencodes the string "COM/OLE." I suppose I could re-write the "list" action to use numeric ids instead of tag names, but I would hate to lose that functionality. Does anybody know how to get routing to work under these circumstances? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Why don''t you use the permalink_fu plugin? It converts all the special characters you described in a pretty url format. So instead of COM/OLE it would be com-ole, then you could easily find your inestances by doing Model.find_by_permalink(params[:permalink) -- Serengeti wrote:> I am using acts_as_taggable according to the examples in the Rails > Recipes book. Everything works fine except for cases where I want to > use a tag with a dot (like .NET) or a slash (like COM/OLE). > > The problem is not really with acts_as_taggable, but rather with > routing. > > I am using the suggested technique where I use urls like /kb/list/ > mytag to display all the entries tagged "mytag." > > Here is the console output showing what happens when I use urls with > dots or slashes: > > This works as expected: > >>> rs.recognize_path "/kb/list/mytag" > => {:id=>"mytag", :action=>"list", :controller=>"kb"} > > But check these out: > >>> rs.recognize_path "/kb/list/.NET" > => {:anything=>["kb", "list", > ".NET"], :controller=>"kb", :action=>"index"} > >>> rs.recognize_path "/kb/list/COM%2FOLE" > => {:anything=>["kb", "list", "COM", > "OLE"], :controller=>"kb", :action=>"index" > } > > Note that I replaced "/" with "%2F" because that''s what happens in the > browser when it urlencodes the string "COM/OLE." > > I suppose I could re-write the "list" action to use numeric ids > instead of tag names, but I would hate to lose that functionality. > > Does anybody know how to get routing to work under these circumstances?-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks for the tip! I''ll give that a try. On Jun 29, 12:37 pm, Mark <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Why don''t you use the permalink_fu plugin? It converts all the special > characters you described in a pretty url format. So instead of COM/OLE > it would be com-ole, then you could easily find your inestances by doing > Model.find_by_permalink(params[:permalink) > > -- > > > > > > Serengeti wrote: > > I am using acts_as_taggable according to the examples in the Rails > > Recipes book. Everything works fine except for cases where I want to > > use a tag with a dot (like .NET) or a slash (like COM/OLE). > > > The problem is not really with acts_as_taggable, but rather with > > routing. > > > I am using the suggested technique where I use urls like /kb/list/ > > mytag to display all the entries tagged "mytag." > > > Here is the console output showing what happens when I use urls with > > dots or slashes: > > > This works as expected: > > >>> rs.recognize_path "/kb/list/mytag" > > => {:id=>"mytag", :action=>"list", :controller=>"kb"} > > > But check these out: > > >>> rs.recognize_path "/kb/list/.NET" > > => {:anything=>["kb", "list", > > ".NET"], :controller=>"kb", :action=>"index"} > > >>> rs.recognize_path "/kb/list/COM%2FOLE" > > => {:anything=>["kb", "list", "COM", > > "OLE"], :controller=>"kb", :action=>"index" > > } > > > Note that I replaced "/" with "%2F" because that''s what happens in the > > browser when it urlencodes the string "COM/OLE." > > > I suppose I could re-write the "list" action to use numeric ids > > instead of tag names, but I would hate to lose that functionality. > > > Does anybody know how to get routing to work under these circumstances? > > -- > Posted viahttp://www.ruby-forum.com/.- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''m a little stuck. Maybe you can help. I am adding: has_permalink :name to the class definition for Tag. When I do this I get an error: C:/InstantRails/ruby/lib/ruby/gems/1.8/gems/activerecord-1 .15.3/lib/active_record/base.rb:1235:in `method_missing'':NoMethodError: undefine d method `has_permalink'' for Tag:Class I assume this means that the acts_as_taggable plugin is trying to load its models before permalink_fu has been loaded. I have tried adding: require ''permalink_fu'' to tag.rb, but that returns file not found errors. I have tried a few different ways of specifying the path to the permalink_fu plugin but none work. Is there another way to accomplish this? On Jun 29, 12:42 pm, Serengeti <market...-XDDYW7GRA3etG0bUXCXiUA@public.gmane.org> wrote:> Thanks for the tip! I''ll give that a try. > > On Jun 29, 12:37 pm, Mark <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > > Why don''t you use the permalink_fu plugin? It converts all the special > > characters you described in a pretty url format. So instead of COM/OLE > > it would be com-ole, then you could easily find your inestances by doing > > Model.find_by_permalink(params[:permalink) > > > -- > > > Serengeti wrote: > > > I am using acts_as_taggable according to the examples in the Rails > > > Recipes book. Everything works fine except for cases where I want to > > > use a tag with a dot (like .NET) or a slash (like COM/OLE). > > > > The problem is not really with acts_as_taggable, but rather with > > > routing. > > > > I am using the suggested technique where I use urls like /kb/list/ > > > mytag to display all the entries tagged "mytag." > > > > Here is the console output showing what happens when I use urls with > > > dots or slashes: > > > > This works as expected: > > > >>> rs.recognize_path "/kb/list/mytag" > > > => {:id=>"mytag", :action=>"list", :controller=>"kb"} > > > > But check these out: > > > >>> rs.recognize_path "/kb/list/.NET" > > > => {:anything=>["kb", "list", > > > ".NET"], :controller=>"kb", :action=>"index"} > > > >>> rs.recognize_path "/kb/list/COM%2FOLE" > > > => {:anything=>["kb", "list", "COM", > > > "OLE"], :controller=>"kb", :action=>"index" > > > } > > > > Note that I replaced "/" with "%2F" because that''s what happens in the > > > browser when it urlencodes the string "COM/OLE." > > > > I suppose I could re-write the "list" action to use numeric ids > > > instead of tag names, but I would hate to lose that functionality. > > > > Does anybody know how to get routing to work under these circumstances? > > > -- > > Posted viahttp://www.ruby-forum.com/.-Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---