1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

#NoMethodError in Messages#index -undefined method `format_posted_time'

Posted at

ActionView::Template::Error (undefined method `format_posted_time' for #<#:0x007ff1a69035b8>):
3: .upper-message__user-name
4: = message.user.name
5: .upper-message__date
6: = format_posted_time(message.created_at)
7: .lower-meesage
8: - if message.content.present?
9: %p.lower-message__content

helper method `format_posted_time'が定義されていない。

6: = format_posted_time(message.created_at)

1.app/helpers/application_helper.rb
2.定義を記述
module ApplicationHelper
def format_posted_time(time)
time.to_s(:default)
end
end

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?