Hi, I wrote a RoR application using "Generators" / "scaffold" in Rails 1.2.6 (via RadRails). Now that I''ve upgraded to Rails 2.0.2., the generated Controller is more REST-like; and that''s fine with me. I''m used to creating new access functions, like this: def simple_list_for_prod_id_xml @foo_bars = FooBars.find_by_sql( ["SELECT blah blah blah FROM FOO_BARS WHERE PROD_ID=?", params[:prod_id]] ) render :xml => @foo_bars.to_xml end Unfortunately, when I try to access it via the URL http://localhost:3003/foo_bars/simple_list_for_prod_id_xml?prod_id=70941000 the server thinks I''m implicitly calling the generated show() function and passing it an ID of "simple_list_for_prod_id_xml"... What can I do to make sure my function is called? I apologize if this has been answered before, but I was unable to find a relevant post. Thanks, Chris. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
gers32
2008-Jan-18 09:18 UTC
[SOLVED] Rails 2 thinks my function name is the ID for show()
I obtained a solution from Railsfrance and just modified the following line in routes.rb: map.resources :foo_bars, :collection => { :simple_list_for_prod_id_xml => :get } Chris. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---