This is really confusing to me- I have some code in a page on the site
I''m working on that works absolutely fine on one version of the code
and
totally doesn''t work on a newer version, in spite of the fact I can see
no difference whatsoever either in the rhtml pages, the controller or
any of the routing code. Right now I literally have no idea what the
cause of this could be.
This code lists FAQ entries (in faq_controller.rb ):
<ul>
<% @questionList.each do |question| %>
<li><%=link_to(question.question,
:action=>''show_question'',
:id=>question.id)%></li>
<% end %>
</ul>
On the current code it gives this output:
<li><a href="/faq/show_question/1">What is question
1?</a></li>
When I switch to the new codebase I get this:
<li><a href="/faq">What is question
1?</a></li>
Every single link I generate with link_to() is having it''s path
replaced
by a link to "/faq" both in the current partial and in the layout.
I added some testing code to see what url_for is returning-
<%
logger.info "Test 1:"+url_for(
:controller=>''faq'',
:action=>''show_question'', :id=>11 )
logger.info "Test 2: "+@controller.send(:url_for,
{:action=>''show_question'', :id=>1})
%>
The former gives /faq the latter gives /faq/show_question/1 but it
doesn''t seem normal to have to keep calling @controller.send to get my
links working.
The other problem I have is that on my staging server and my local
machine I don''t have this problem- it only arises on the live
deployment
server when it is running in production mode, which means I can only
test it for seconds at the time if I don''t want to start seriously
interfering with our users'' experience.
Any guesses as to what might be causing this? It''s driving me up the
wall.
--
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
-~----------~----~----~----~------~----~------~--~---