ruby - Rails - *_path returning absolute path instead of relative path -
i'm working through chapter 5 of https://www.railstutorial.org. when running rails server footer link rendering: "href=localhost:3000/about" instead of "/about".
here relevant code view:
<%= link_to "about", about_path %> <%= link_to "contact", contact_path %> here routes.rb:
root 'static_pages#home' 'help' => 'static_pages#help' 'about' => 'static_pages#about' 'contact' => 'static_pages#contact' i included contact link because returning desired "/contact". driving me little crazy.
i'll include test file well:
test "layout links" root_path assert_template 'static_pages/home' assert_select "a[href=?]", root_path, count: 2 assert_select "a[href=?]", help_path assert_select "a[href=?]", about_path assert_select "a[href=?]", contact_path end the resulting error is:
sitelayouttest#test_layout_links [/sample_app/test/integration/site_layout_test.rb:9]: expected @ least 1 element matching "a[href="/about"]", found 0..
Comments
Post a Comment