rails generate active_admin:resource district
を実行して、私はactiveadminダッシュボードメニューでDistricts
メニューオプションを参照してくださいが、私はそれをクリックしたときに、私はこのエラー(URLはlocalhost:3000/adminに/地区)を取得
は、端末からの全体の出力である:ここでは
Started GET "/admin/districts" for ::1 at 2016-12-02 17:58:23 -0700
Processing by Admin::DistrictsController#index as HTML
AdminUser Load (0.4ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = $1 ORDER BY "admin_users"."id" ASC LIMIT $2 [["id", 1], ["LIMIT", 1]]
Completed 500 Internal Server Error in 8ms (ActiveRecord: 0.4ms)
NoMethodError (undefined method `column_names' for District:Module):
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/activeadmin-a932d56b156e/lib/active_admin/resource.rb:101:in `resource_column_names'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/activeadmin-a932d56b156e/lib/active_admin/order_clause.rb:19:in `to_sql'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/activeadmin-a932d56b156e/lib/active_admin/resource_controller/data_access.rb:216:in `apply_sorting'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/activeadmin-a932d56b156e/lib/active_admin/resource_controller/data_access.rb:58:in `block in find_collection'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/activeadmin-a932d56b156e/lib/active_admin/resource_controller/data_access.rb:57:in `each'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/activeadmin-a932d56b156e/lib/active_admin/resource_controller/data_access.rb:57:in `find_collection'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/activeadmin-a932d56b156e/lib/active_admin/resource_controller/data_access.rb:42:in `collection'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/inherited_resources-4434f0ae72f7/lib/inherited_resources/actions.rb:7:in `index'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/activeadmin-a932d56b156e/lib/active_admin/resource_controller/streaming.rb:12:in `index'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/abstract_controller/base.rb:188:in `process_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_controller/metal/rendering.rb:30:in `process_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activesupport/lib/active_support/callbacks.rb:132:in `run_callbacks'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/abstract_controller/callbacks.rb:19:in `process_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_controller/metal/rescue.rb:20:in `process_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activesupport/lib/active_support/notifications.rb:164:in `block in instrument'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activesupport/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activesupport/lib/active_support/notifications.rb:164:in `instrument'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_controller/metal/instrumentation.rb:30:in `process_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activerecord/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/abstract_controller/base.rb:126:in `process'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionview/lib/action_view/rendering.rb:30:in `process'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_controller/metal.rb:194:in `dispatch'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_controller/metal.rb:266:in `dispatch'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/routing/route_set.rb:49:in `dispatch'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/routing/route_set.rb:31:in `serve'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/journey/router.rb:39:in `block in serve'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/journey/router.rb:26:in `each'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/journey/router.rb:26:in `serve'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/routing/route_set.rb:725:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/cookies.rb:613:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
warden (1.2.6) lib/warden/manager.rb:35:in `block in call'
warden (1.2.6) lib/warden/manager.rb:34:in `catch'
warden (1.2.6) lib/warden/manager.rb:34:in `call'
rack (2.0.1) lib/rack/etag.rb:25:in `call'
rack (2.0.1) lib/rack/conditional_get.rb:25:in `call'
rack (2.0.1) lib/rack/head.rb:12:in `call'
rack (2.0.1) lib/rack/session/abstract/id.rb:222:in `context'
rack (2.0.1) lib/rack/session/abstract/id.rb:216:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/cookies.rb:613:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activerecord/lib/active_record/migration.rb:555:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activesupport/lib/active_support/callbacks.rb:104:in `run_callbacks'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/callbacks.rb:36:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/debug_exceptions.rb:59:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/railties/lib/rails/rack/logger.rb:36:in `call_app'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/railties/lib/rails/rack/logger.rb:24:in `block in call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activesupport/lib/active_support/tagged_logging.rb:69:in `block in tagged'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activesupport/lib/active_support/tagged_logging.rb:26:in `tagged'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activesupport/lib/active_support/tagged_logging.rb:69:in `tagged'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/railties/lib/rails/rack/logger.rb:24:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/request_id.rb:25:in `call'
rack (2.0.1) lib/rack/method_override.rb:22:in `call'
rack (2.0.1) lib/rack/runtime.rb:22:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/activesupport/lib/active_support/cache/strategy/local_cache_middleware.rb:27:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/executor.rb:12:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/actionpack/lib/action_dispatch/middleware/static.rb:125:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
/Users/username/.rvm/gems/ruby-2.3.0/bundler/gems/rails-45f8848ca7d7/railties/lib/rails/engine.rb:522:in `call'
puma (3.6.2) lib/puma/configuration.rb:225:in `call'
puma (3.6.2) lib/puma/server.rb:578:in `handle_request'
puma (3.6.2) lib/puma/server.rb:415:in `process_client'
puma (3.6.2) lib/puma/server.rb:275:in `block in run'
puma (3.6.2) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
は、いくつかの追加情報
モデル/ district.rb
module District
def self.table_name_prefix
'district_'
end
end
アプリ/管理/地区です.rb
私は問題が何であるかを見つけることができないよう5.1.0.alpha
ActiveAdmin.register District do
index do
selectable_column
id_column
column :name
column :created_at
actions
end
end
Rubyのバージョン ルビー2.3.0p0
Railsのバージョン Railsの。どんな助けもありがとう!
私はそれを得ました!あなたの答えは私に、私の思考プロセスをモデルモジュールで修正し、どのように働かせるか教えてくれます。モジュールはちょうど名前空間なので、名前空間を作り、そこに 'district'を置く必要があります。' rails g model somenamespace/district'を実行し、 'rails generate active_admin:resource somenamespace/district'を実行します。必要です。あなたの指導に感謝します! – Awatatah