LoginSignup
1
3

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 #<#Class:0x007ff1a676f6c0: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