Venkat Eee
2009-Jul-16 06:38 UTC
Plz hlp :-( Link is not directing to function in controller
Hi all, The below link is not directing to media_files_list function but directing to the show function. Please help, i want to direct it to media_files_list function. In controller i declared... def media_files_list Please note: i want to use get-method as below. <a onclick="new Ajax.Request(''/media_files/media_files_list'', {asynchronous:true, evalScripts:true, method:''get'', onSuccess:function(request){handleData(request,"centernav")}, parameters:''module_id=MENU09041512&upload_list=true&page=2'' + ''&authenticity_token='' + encodeURIComponent(''s5Tjz5cJJl28uR0OGMbALzbh8ktwLkL2+fVjPBruqmk='')}); return false;" href="#">2</a> -- Posted via http://www.ruby-forum.com/.
Rails List
2009-Jul-16 06:49 UTC
Re: Plz hlp :-( Link is not directing to function in controller
Provide the actual line of code -- Posted via http://www.ruby-forum.com/.
Venkat Eee
2009-Jul-16 06:52 UTC
Re: Plz hlp :-( Link is not directing to function in controller
Rails List wrote:> > Provide the actual line of code<%= link_to_remote page_no, :success =>''handleData(request,"centernav")'', :url => { :action => params[:action], :controller =>params[:controller] }, :with => "''module_id=#{module_id}&upload_list=true&page=#{page_no}''", :method => :get %> <% end %> -- Posted via http://www.ruby-forum.com/.
Virendra Negi
2009-Jul-16 09:55 UTC
Re: Plz hlp :-( Link is not directing to function in controller
Venkat Eee wrote:> Rails List wrote: >> >> Provide the actual line of code > > <%= link_to_remote page_no, > :success =>''handleData(request,"centernav")'', > :url => { > :action => params[:action], > :controller =>params[:controller] > }, > :with => > "''module_id=#{module_id}&upload_list=true&page=#{page_no}''", > :method => :get > %> > <% end %>dude i think you have written this code in your show.html.erb and because of that params[:action] is going to return "show" that why your request is going to show action instead of def media_files_list used something like this <%= link_to_remote page_no, :success =>''handleData(request,"centernav")'', :url => media_files_list_["your controller name"]_path(parameter) :with => "''module_id=#{module_id}&upload_list=true&page=#{page_no}''", :method => :get %> <% end %> this should work do rake routes for more information controller name can be singular or plural based on the definition of your methods defined in your route.rb -- Posted via http://www.ruby-forum.com/.