0

Here is a strange issue.

In my application helper, there is a method named test, and an other method named article_url. I have the article resource, and generate its url_helpers. In the test method, i call article_url, but it access the url_helper method instead of the method i defined in helper.

My project runs well in Rails 3.0, but when i upgrade to 3.2, it raise the issue. And under 3.2, development mode runs well but production raise issue.

Please forgive my poor english :-)

Sorry, code like this:

# application_helper.rb
module ApplicationHelper

  ...

  def article_url(article, html_suffix = true)
    if article.redirect_to.present?
      article.redirect_to
    else
      url = "#{Settings.host}/articles/#{article.created_at.strftime("%Y-%m-%d")}/#{article.id}"
      url += ".html" if html_suffix
      url
    end
  end

  ...

  def render_article_list(article)
    link_to(xxx, article_url(article), {:target => "_blank"})
  end

end

1 Answers1

0

Rename your helper method. If you have a helper named article_url and a resource named article then article_url will be ambiguous between the routes and the helper. If you don't think this is the issue, post some code to help us narrow down the problem.

Matt
  • 13,948
  • 6
  • 44
  • 68