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 ):
-
<% @questionList.each do |question| %>
- <%=link_to(question.question, :action=>'show_question', :id=>question.id)%> <% end %>
On the current code it gives this output:
When I switch to the new codebase I get this:
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: "[email protected](: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.