今railsのチュートリアルを勉強をしているのですが以下のエラーが出てしましました。
ERROR["test_should_get_about", StaticPagesControllerTest, 0.15483889400002226] test_should_get_about#StaticPagesControllerTest (0.16s) ActionView::Template::Error: ActionView::Template::Error: undefined method `full_title' for #<#<Class:0x0000000442a7a8>:0x007efde9027ea0> app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb___878930355759497988_69814500201200' test/controllers/static_pages_controller_test.rb:21:in `block in <class:StaticPagesControllerTest>'
ERROR["test_should_get_help", StaticPagesControllerTest, 0.17752699900029256] test_should_get_help#StaticPagesControllerTest (0.18s) ActionView::Template::Error: ActionView::Template::Error: undefined method `full_title' for #<#<Class:0x0000000442a7a8>:0x007efde8b425c0> app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb___878930355759497988_69814500201200' test/controllers/static_pages_controller_test.rb:15:in `block in <class:StaticPagesControllerTest>'
ERROR["test_should_get_root", StaticPagesControllerTest, 0.19998181099981593] test_should_get_root#StaticPagesControllerTest (0.20s) ActionView::Template::Error: ActionView::Template::Error: undefined method `full_title' for #<#<Class:0x0000000442a7a8>:0x007efde8665ca0> app/views/layouts/application.html.erb:4:in `_app_views_layouts_application_html_erb___878930355759497988_69814500201200' test/controllers/static_pages_controller_test.rb:9:in `block in <class:StaticPagesControllerTest>'
以上が出ている出ているエラーで
module ApplicationHelper # ページごとの完全なタイトルを返します。 def full_title(page_title = '') base_title = "Ruby on Rails Tutorial Sample App" if page_title.empty? base_title else page_title + " | " + base_title end end end
これがmethodを定義したfileです。
<% provide(:title, "Help") %> <h1>Help</h1> <p> Get help on the Ruby on Rails Tutorial at the <a href="https://railstutorial.jp/help">Rails Tutorial help page</a>. To get help on this sample app, see the <a href="https://railstutorial.jp/#ebook"> <em>Ruby on Rails Tutorial</em> book</a>. </p>
<!DOCTYPE html> <html> <head> <title><%= full_title(yield(:title)) %></title> <%= csrf_meta_tags %> <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> </head> <body> <%= yield %> </body> </html>
<h1>Sample App</h1> <p> This is the home page for the <a href="https://railstutorial.jp/">Ruby on Rails Tutorial</a> sample application. </p>
これらがhtmlfileです。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー