Here is the error I get
这是我得到的错误
ArgumentError in External_articles#show
Showing app/views/external_articles/show.html.erb where line #3 raised:
wrong number of arguments (0 for 1)
Extracted source (around line #3):
1: <p>
2: <b>Title:</b>
3: <%= @external_article.title %>
4: </p>
5:
But in the console, It works fine.
但在控制台中,它工作正常。
?> ExternalArticle
=> ExternalArticle(id: integer, title: string, url: string, language: string, source: string, date: date, created_at: datetime, updated_at: datetime, event_id: integer)
>> ExternalArticle.last.title
=> "Two course records shattered in Va. Beach marathon "
All the other attributes are displayed correctly in the view. And if I rename the title attritute to 'article_title' it will work.
所有其他属性在视图中正确显示。如果我将标题attritute重命名为'article_title',它将起作用。
I don't get what the problem is. The view used to work well.
我不知道问题是什么。以前的观点运作良好。
Any clue? Thanks
任何线索?谢谢
1 个解决方案
#1
1
I finally found the source of the problem. I had created a global helper method called title, that used a parameter. When I renamed the helper method, everything worked again.
我终于找到了问题的根源。我创建了一个名为title的全局辅助方法,它使用了一个参数。当我重命名帮助方法时,一切都恢复了。
#1
1
I finally found the source of the problem. I had created a global helper method called title, that used a parameter. When I renamed the helper method, everything worked again.
我终于找到了问题的根源。我创建了一个名为title的全局辅助方法,它使用了一个参数。当我重命名帮助方法时,一切都恢复了。