LoginSignup
0
0

More than 5 years have passed since last update.

Admin以下のviewファイルでmethod: :delete出来ない件について。

Last updated at Posted at 2018-04-09

原因

admin以下のviewファイルで rails-ujs を読み込めていなかった。

application.js
...
//= require rails-ujs
...

解決

controllers/admin/application_controller.rb
class Admin::ApplicationController < ActionController::Base
  # ↓追記
  layout 'application'
end

解説

rails-ujs を読み込むよう書いてある application.html.erb (rails new時に作成済)を、
admin下viewファイルのレイアウトに指定する。

views/layouts/application.html.erb
<!DOCTYPE html>
<html>
  <head>
    <title>AppName</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>
0
0
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
0
0