简体   繁体   中英

I'm having en error when I try to fetch the argument of an activeRecord object in a view in rails 2.3.11

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.

I don't get what the problem is. The view used to work well.

Any clue? Thanks

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM