dimanche 3 janvier 2016

Getting undefined method `created_at'

Why is this so? Is there any chance I can get created date of my object?

index.html.erb

<td><%= link_to 'Show', article_date(article) %></td>

articles_helper.rb

module ArticlesHelper
  def article_date(article)
    published_at = article.created_at
    options = {
      year: published_at.strftime('%Y'),
      month: published_at.strftime('%m'),
      day: published_at.strftime('%d'),
      id: article.id
    }
    article_date(options)
  end
end

Aucun commentaire:

Enregistrer un commentaire