2
votes

My routes.rbThe result from http://localhost:3000/contacts when clicked for the first time:

Rails.application.routes.draw do
  devise_for :admin_users, ActiveAdmin::Devise.config
  ActiveAdmin.routes(self)
  devise_for :contacts
  devise_for :homes
  resources :contacts
  resources :homes

  root 'homes#index'
end

When I 'rake routes' these are the results:

                           Prefix Verb       URI Pattern                                                                              Controller#Action
           new_admin_user_session GET        /admin/login(.:format)                                                                   active_admin/devise/sessions#new
               admin_user_session POST       /admin/login(.:format)                                                                   active_admin/devise/sessions#create
       destroy_admin_user_session DELETE|GET /admin/logout(.:format)                                                                  active_admin/devise/sessions#destroy
          new_admin_user_password GET        /admin/password/new(.:format)                                                            active_admin/devise/passwords#new
         edit_admin_user_password GET        /admin/password/edit(.:format)                                                           active_admin/devise/passwords#edit
              admin_user_password PATCH      /admin/password(.:format)                                                                active_admin/devise/passwords#update
                                  PUT        /admin/password(.:format)                                                                active_admin/devise/passwords#update
                                  POST       /admin/password(.:format)                                                                active_admin/devise/passwords#create
                       admin_root GET        /admin(.:format)                                                                         admin/dashboard#index
      batch_action_admin_contacts POST       /admin/contacts/batch_action(.:format)                                                   admin/contacts#batch_action
                   admin_contacts GET        /admin/contacts(.:format)                                                                admin/contacts#index
                                  POST       /admin/contacts(.:format)                                                                admin/contacts#create
                new_admin_contact GET        /admin/contacts/new(.:format)                                                            admin/contacts#new
               edit_admin_contact GET        /admin/contacts/:id/edit(.:format)                                                       admin/contacts#edit
                    admin_contact GET        /admin/contacts/:id(.:format)                                                            admin/contacts#show
                                  PATCH      /admin/contacts/:id(.:format)                                                            admin/contacts#update
                                  PUT        /admin/contacts/:id(.:format)                                                            admin/contacts#update
                                  DELETE     /admin/contacts/:id(.:format)                                                            admin/contacts#destroy
   batch_action_admin_admin_users POST       /admin/admin_users/batch_action(.:format)                                                admin/admin_users#batch_action
                admin_admin_users GET        /admin/admin_users(.:format)                                                             admin/admin_users#index
                                  POST       /admin/admin_users(.:format)                                                             admin/admin_users#create
             new_admin_admin_user GET        /admin/admin_users/new(.:format)                                                         admin/admin_users#new
            edit_admin_admin_user GET        /admin/admin_users/:id/edit(.:format)                                                    admin/admin_users#edit
                 admin_admin_user GET        /admin/admin_users/:id(.:format)                                                         admin/admin_users#show
                                  PATCH      /admin/admin_users/:id(.:format)                                                         admin/admin_users#update
                                  PUT        /admin/admin_users/:id(.:format)                                                         admin/admin_users#update
                                  DELETE     /admin/admin_users/:id(.:format)                                                         admin/admin_users#destroy
                  admin_dashboard GET        /admin/dashboard(.:format)                                                               admin/dashboard#index
         batch_action_admin_homes POST       /admin/homes/batch_action(.:format)                                                      admin/homes#batch_action
                      admin_homes GET        /admin/homes(.:format)                                                                   admin/homes#index
                                  POST       /admin/homes(.:format)                                                                   admin/homes#create
                   new_admin_home GET        /admin/homes/new(.:format)                                                               admin/homes#new
                  edit_admin_home GET        /admin/homes/:id/edit(.:format)                                                          admin/homes#edit
                       admin_home GET        /admin/homes/:id(.:format)                                                               admin/homes#show
                                  PATCH      /admin/homes/:id(.:format)                                                               admin/homes#update
                                  PUT        /admin/homes/:id(.:format)                                                               admin/homes#update
                                  DELETE     /admin/homes/:id(.:format)                                                               admin/homes#destroy
                   admin_comments GET        /admin/comments(.:format)                                                                admin/comments#index
                                  POST       /admin/comments(.:format)                                                                admin/comments#create
                    admin_comment GET        /admin/comments/:id(.:format)                                                            admin/comments#show
                                  DELETE     /admin/comments/:id(.:format)                                                            admin/comments#destroy
                         contacts GET        /contacts(.:format)                                                                      contacts#index
                                  POST       /contacts(.:format)                                                                      contacts#create
                      new_contact GET        /contacts/new(.:format)                                                                  contacts#new
                     edit_contact GET        /contacts/:id/edit(.:format)                                                             contacts#edit
                          contact GET        /contacts/:id(.:format)                                                                  contacts#show
                                  PATCH      /contacts/:id(.:format)                                                                  contacts#update
                                  PUT        /contacts/:id(.:format)                                                                  contacts#update
                                  DELETE     /contacts/:id(.:format)                                                                  contacts#destroy
                            homes GET        /homes(.:format)                                                                         homes#index
                                  POST       /homes(.:format)                                                                         homes#create
                         new_home GET        /homes/new(.:format)                                                                     homes#new
                        edit_home GET        /homes/:id/edit(.:format)                                                                homes#edit
                             home GET        /homes/:id(.:format)                                                                     homes#show
                                  PATCH      /homes/:id(.:format)                                                                     homes#update
                                  PUT        /homes/:id(.:format)                                                                     homes#update
                                  DELETE     /homes/:id(.:format)                                                                     homes#destroy
                             root GET        /                                                                                        homes#index
    rails_mandrill_inbound_emails POST       /rails/action_mailbox/mandrill/inbound_emails(.:format)                                  action_mailbox/ingresses/mandrill/inbound_emails#create
    rails_postmark_inbound_emails POST       /rails/action_mailbox/postmark/inbound_emails(.:format)                                  action_mailbox/ingresses/postmark/inbound_emails#create
       rails_relay_inbound_emails POST       /rails/action_mailbox/relay/inbound_emails(.:format)                                     action_mailbox/ingresses/relay/inbound_emails#create
    rails_sendgrid_inbound_emails POST       /rails/action_mailbox/sendgrid/inbound_emails(.:format)                                  action_mailbox/ingresses/sendgrid/inbound_emails#create
     rails_mailgun_inbound_emails POST       /rails/action_mailbox/mailgun/inbound_emails/mime(.:format)                              action_mailbox/ingresses/mailgun/inbound_emails#create
   rails_conductor_inbound_emails GET        /rails/conductor/action_mailbox/inbound_emails(.:format)                                 rails/conductor/action_mailbox/inbound_emails#index
                                  POST       /rails/conductor/action_mailbox/inbound_emails(.:format)                                 rails/conductor/action_mailbox/inbound_emails#create
new_rails_conductor_inbound_email GET        /rails/conductor/action_mailbox/inbound_emails/new(.:format)                             rails/conductor/action_mailbox/inbound_emails#new

edit_rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id/edit(.:format) rails/conductor/action_mailbox/inbound_emails#edit rails_conductor_inbound_email GET /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#show PATCH /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#update PUT /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#update DELETE /rails/conductor/action_mailbox/inbound_emails/:id(.:format) rails/conductor/action_mailbox/inbound_emails#destroy rails_conductor_inbound_email_reroute POST /rails/conductor/action_mailbox/:inbound_email_id/reroute(.:format) rails/conductor/action_mailbox/reroutes#create rails_service_blob GET /rails/active_storage/blobs/:signed_id/*filename(.:format) active_storage/blobs#show rails_blob_representation GET /rails/active_storage/representations/:signed_blob_id/:variation_key/*filename(.:format) active_storage/representations#show rails_disk_service GET /rails/active_storage/disk/:encoded_key/*filename(.:format) active_storage/disk#show update_rails_disk_service PUT /rails/active_storage/disk/:encoded_token(.:format) active_storage/disk#update rails_direct_uploads POST /rails/active_storage/direct_uploads(.:format) active_storage/direct_uploads#create

Part of my views(_header.html.erb):

    <div class="collapse navbar-collapse offset" id="navbarSupportedContent">
      <ul class="nav navbar-nav menu_nav ml-auto">
        <li class="nav-item"><a class="nav-link active" href="/">Home</li>
        <li class="nav-item"><a class="nav-link" href="#abouts">About</a></li>
        <li class="nav-item"><a class="nav-link" href="#services">Services</a></li>
        <li class="nav-item"><a class="nav-link" href="contacts">Contact</a></li>
      </ul>
    </div>
2
Welcome to Stack Overflow! Please read through the formatting help. "How do I format my posts..." and "How do I format my code blocks?". Also, please do NOT use images to convey information about errors. "Discourage screenshots of code and/or errors" helps to explain why.the Tin Man

2 Answers

3
votes

edit:

OMG, finally I found out why this happened! My application.html.erb template was copied from a bootstrap template and that contained a script-tag that wrote "2020"!

Copyright &copy;<script>document.write(new Date().getFullYear());</script> 

I had the same problem but for a form. My solution was to add local: true to form_with. That's also the way rails scaffold does it:

Disable Turbolinks on forms:

<%= form_with(url: "/home/register", method: "post", local: true) do %>

Removing turbolinks from application.js didn't work for me. I think that you would also have to remove turbolinks from the Gemfile, but I didn't want to globally disable turbolinks.

Disable Turbolinks on links:

// disable turbolinks for one link
<%= link_to('Home', home_index_path, data: { turbolinks: false }) %>

// disables turbolinks for all links inside a div tag
<div data-turbolinks="false">
  <%= link_to... %>
</div>

I would recommend using browser dev-tools to inspect the ajax calls that turbolinks create (header and content of the response).

1
votes

Solved it by removing 'require("turbolinks").start()' from app/javascript/packs/application.js file