这可能是一个非常棘手的问题,但我对 Rails 还很陌生,我正在开发我的第一个 Rails 应用程序。
这一切都是在未能创建仪表板功能时发生的。不知何故,所有仪表板控制器和模型都被删除了,我正在努力恢复它们。同样,rails_admin 已受到影响,将不再工作。
我试过捆绑安装,rake db:reset db:migrate 仍然出现这个错误..
ERROR: relation "dashboards" does not exist
LINE 8: WHERE a.attrelid = '"dashboards"'::regclass
这是我们在 /admin 访问管理面板的测试
require "rails_helper"
RSpec.feature "Visiting Admin Panel" do
before do
@Anag = User.create(first_name: "Anag", middle_initial: "A", last_name: "Avatar", email: "AnagAvatar@example.com", password: "Password", birthday: Date.new(1996), bio: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. In vitae tincidunt orci. Quisque mauris
tortor, dignissim ac dignissim ut, blandit eget risus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam mollis augue vestibulum dui facilisis sollicitudin. Nullam sit amet mattis elit. Nulla volutpat elementum enim sed viverra. Cras ante dolor, commodo eu
velit quis, sagittis egestas erat. Ut ac commodo mauris. Cras quis efficitur ipsum. Fusce fringilla felis ac lectus aliquet, quis dictum sapien posuere. Nunc iaculis lacinia augue, et hendrerit nibh mollis a. Sed sed dolor orci. Sed et turpis dictum, eleifend risus sit
amet, ultricies eros. Vivamus finibus sapien mauris, a tincidunt nisi eleifend vitae. Maecenas libero sapien, pulvinar et turpis a, malesuada sodales justo.", occupation: "Avatar", motto: "motto motto motto", website_link: "https://en.wikipedia.org/wiki/Avatar:_The_Last_Airbender",
hometown: "Air Temple, Western Air Temple",
confirmed_at: DateTime.new(2017), admin: true)
nfirmed_at: DateTime.new(2017))
end
scenario "with signed in user who's an admin" do
login_as(@Anag)
visit "admin"
expect(current_path).to eq "/admin"
expect(page).to have_content("Site Administration")
first(:link, "Assignments").click
expect(page).to have_content("List of Assignments")
end
end
这是rspec测试结果
Visiting Admin Panel with signed in user who's an admin
Failure/Error: visit "admin"
ActiveRecord::StatementInvalid:
PG::UndefinedTable: ERROR: relation "dashboards" does not exist
LINE 8: WHERE a.attrelid = '"dashboards"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod,
(SELECT c.collname FROM pg_collation c, pg_type t
WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation),
col_description(a.attrelid, a.attnum) AS comment
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"dashboards"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rails_admin-1.1.0/lib/rails_admin/adapters/active_record.rb:43:in `count'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rails_admin-1.1.0/lib/rails_admin/config/actions/dashboard.rb:26:in `block (3 levels) in <class:Dashboard>'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rails_admin-1.1.0/lib/rails_admin/config/actions/dashboard.rb:24:in `each'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rails_admin-1.1.0/lib/rails_admin/config/actions/dashboard.rb:24:in `block (2 levels) in <class:Dashboard>'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rails_admin-1.1.0/app/controllers/rails_admin/main_controller.rb:22:in `instance_eval'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rails_admin-1.1.0/app/controllers/rails_admin/main_controller.rb:22:in `dashboard'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:522:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/railtie.rb:193:in `public_send'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/railtie.rb:193:in `method_missing'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-pjax-1.0.0/lib/rack/pjax.rb:12:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/remotipart-1.3.1/lib/remotipart/middleware.rb:32:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/warden-1.2.6/lib/warden/manager.rb:35:in `block in call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `catch'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/warden-1.2.6/lib/warden/manager.rb:34:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/etag.rb:25:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/conditional_get.rb:25:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/head.rb:12:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:222:in `context'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/session/abstract/id.rb:216:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:36:in `call_app'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `block in call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/rack/logger.rb:24:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/method_override.rb:22:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/runtime.rb:22:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/sendfile.rb:111:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/railties-5.0.0.1/lib/rails/engine.rb:522:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/urlmap.rb:68:in `block in call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `each'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-2.0.1/lib/rack/urlmap.rb:53:in `call'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/capybara-2.11.0/lib/capybara/rack_test/browser.rb:61:in `process'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/capybara-2.11.0/lib/capybara/rack_test/browser.rb:36:in `process_and_follow_redirects'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/capybara-2.11.0/lib/capybara/rack_test/browser.rb:22:in `visit'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/capybara-2.11.0/lib/capybara/rack_test/driver.rb:43:in `visit'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/capybara-2.11.0/lib/capybara/session.rb:246:in `visit'
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/capybara-2.11.0/lib/capybara/dsl.rb:52:in `block (2 levels) in <module:DSL>'
# ./spec/features/viewing_admin_panel_spec.rb:53:in `block (2 levels) in <top (required)>'
# ------------------
# --- Caused by: ---
# PG::UndefinedTable:
# ERROR: relation "dashboards" does not exist
# LINE 8: WHERE a.attrelid = '"dashboards"'::regclass
# ^
# /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/rails_admin-1.1.0/lib/rails_admin/adapters/active_record.rb:43:in `count'
这是我们的 gem 文件:
source 'https://rubygems.org'
# Ruby 2.2.4
ruby '2.3.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0', '>= 5.0.0.1'
# Use postgresql as the database for Active Record
gem 'pg', '~> 0.18'
gem 'puma', '~> 3.0'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.2'
gem 'jquery-rails'
gem 'turbolinks', '~> 5'
https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platform: :mri
gem 'rspec-rails', '~> 3.4', '>= 3.4.2'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
gem 'web-console'
gem 'listen', '~> 3.0.5'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
# Added Development gems
gem 'better_errors'
gem 'binding_of_caller' # For better_errors advanced features
gem 'brakeman', require: false # Checking Security
gem 'guard', '~> 2.14'
gem 'guard-rspec', '~> 4.7', '>= 4.7.3'
gem 'guard-cucumber', '~> 2.1', '>= 2.1.2'
end
group :test do
# gem 'faker', '~> 1.6', '>= 1.6.3'
# gem 'shoulda-matchers', '~> 3.1', '>= 3.1.1', require: false
gem 'database_cleaner', '~> 1.5'
gem 'simplecov', require: false
gem 'capybara', '~> 2.7', '>= 2.7.1'
end
gem 'spring-commands-rspec', :groups => [:development, :test]
gem 'factory_girl_rails', :groups => [:development, :test]
# Added gems
gem 'rails_admin', '~> 1.0'
gem 'figaro'
gem 'slim-rails'
# Authentication
gem 'devise', '~> 4.2.0'
# Authorization
gem 'pundit', '~> 1.1'
gem 'geocoder', '~> 1.4.0'
# Forms
gem 'simple_form'
gem 'country_select'
gem 'mail_form', '~> 1.3.0'
gem 'kaminari', '~> 0.17.0'
gem 'carrierwave', '~> 0.11.2'
gem 'mini_magick', '~> 4.5.1'
gem 'fog-aws'
gem 'unf'
gem 'file_validators' # File Size Validations, May be out of date
# Debudding & Errors
gem 'rubocop', '~> 0.45.0', require: false
# SEO
gem 'meta-tags'
gem 'sitemap_generator'
# Cron jobs
gem 'whenever', require: false
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
这是我访问 localhost:3000/admin 时的服务器日志输出
Processing by RailsAdmin::MainController#dashboard as HTML
(2.9ms) SELECT COUNT(*) FROM "posts" WHERE "posts"."type" IN ('Announcement')
Announcement Load (1.1ms) SELECT "posts".* FROM "posts" WHERE "posts"."type" IN ('Announcement') ORDER BY "posts"."created_at" ASC LIMIT $1 [["LIMIT", 1]]
(3.5ms) SELECT COUNT(*) FROM "assignments"
Assignment Load (0.6ms) SELECT "assignments".* FROM "assignments" ORDER BY "assignments"."id" DESC LIMIT $1 [["LIMIT", 1]]
(0.9ms) SELECT COUNT(*) FROM "categories"
(0.7ms) SELECT COUNT(*) FROM "comments"
Comment Load (0.5ms) SELECT "comments".* FROM "comments" ORDER BY "comments"."created_at" ASC LIMIT $1 [["LIMIT", 1]]
(0.8ms) SELECT COUNT(*) FROM "posts" WHERE "posts"."type" IN ('Coupon')
Coupon Load (0.8ms) SELECT "posts".* FROM "posts" WHERE "posts"."type" IN ('Coupon') ORDER BY "posts"."created_at" ASC LIMIT $1 [["LIMIT", 1]]
Completed 500 Internal Server Error in 614ms (ActiveRecord: 42.8ms)
DEPRECATION WARNING: #original_exception is deprecated. Use #cause instead. (called from initialize at /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/better_errors-2.1.1/lib/better_errors/raised_exception.rb:7)
DEPRECATION WARNING: #original_exception is deprecated. Use #cause instead. (called from initialize at /Users/MarcusKA/.rvm/gems/ruby-2.3.0/gems/better_errors-2.1.1/lib/better_errors/raised_exception.rb:8)
PG::UndefinedTable - ERROR: relation "dashboards" does not exist
LINE 8: WHERE a.attrelid = '"dashboards"'::regclass
^
:
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:88:in `block in query'
activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract_adapter.rb:566:in `block in log'
activesupport (5.0.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activerecord (5.0.0.1) lib/active_record/connection_adapters/abstract_adapter.rb:560:in `log'
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql/database_statements.rb:87:in `query'
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql_adapter.rb:739:in `column_definitions'
activerecord (5.0.0.1) lib/active_record/connection_adapters/postgresql/schema_statements.rb:227:in `columns'
activerecord (5.0.0.1) lib/active_record/connection_adapters/schema_cache.rb:56:in `columns'
activerecord (5.0.0.1) lib/active_record/connection_adapters/schema_cache.rb:62:in `columns_hash'
activerecord (5.0.0.1) lib/active_record/model_schema.rb:354:in `load_schema!'
activerecord (5.0.0.1) lib/active_record/attributes.rb:233:in `load_schema!'
activerecord (5.0.0.1) lib/active_record/attribute_decorators.rb:28:in `load_schema!'
activerecord (5.0.0.1) lib/active_record/model_schema.rb:349:in `load_schema'
activerecord (5.0.0.1) lib/active_record/model_schema.rb:261:in `columns'
activerecord (5.0.0.1) lib/active_record/model_schema.rb:298:in `column_names'
activerecord (5.0.0.1) lib/active_record/relation/calculations.rb:216:in `aggregate_column'
activerecord (5.0.0.1) lib/active_record/relation/calculations.rb:239:in `execute_simple_calculation'
activerecord (5.0.0.1) lib/active_record/relation/calculations.rb:209:in `perform_calculation'
activerecord (5.0.0.1) lib/active_record/relation/calculations.rb:118:in `calculate'
activerecord (5.0.0.1) lib/active_record/relation/calculations.rb:40:in `count'
rails_admin (1.1.0) lib/rails_admin/adapters/active_record.rb:43:in `count'
rails_admin (1.1.0) lib/rails_admin/config/actions/dashboard.rb:26:in `block (3 levels) in <class:Dashboard>'
rails_admin (1.1.0) lib/rails_admin/config/actions/dashboard.rb:24:in `block (2 levels) in <class:Dashboard>'
rails_admin (1.1.0) app/controllers/rails_admin/main_controller.rb:22:in `dashboard'
actionpack (5.0.0.1) lib/action_controller/metal/basic_implicit_render.rb:4:in `send_action'
actionpack (5.0.0.1) lib/abstract_controller/base.rb:188:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/rendering.rb:30:in `process_action'
actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:126:in `call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:506:in `block (2 levels) in compile'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:455:in `call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:101:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_process_action_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/rescue.rb:20:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (5.0.0.1) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (5.0.0.1) lib/active_support/notifications.rb:164:in `instrument'
actionpack (5.0.0.1) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (5.0.0.1) lib/action_controller/metal/params_wrapper.rb:248:in `process_action'
activerecord (5.0.0.1) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (5.0.0.1) lib/abstract_controller/base.rb:126:in `process'
actionview (5.0.0.1) lib/action_view/rendering.rb:30:in `process'
actionpack (5.0.0.1) lib/action_controller/metal.rb:190:in `dispatch'
actionpack (5.0.0.1) lib/action_controller/metal.rb:262:in `dispatch'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:32:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
railties (5.0.0.1) lib/rails/railtie.rb:193:in `method_missing'
actionpack (5.0.0.1) lib/action_dispatch/routing/mapper.rb:17:in `block in <class:Constraints>'
actionpack (5.0.0.1) lib/action_dispatch/routing/mapper.rb:46:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:39:in `block in serve'
actionpack (5.0.0.1) lib/action_dispatch/journey/router.rb:26:in `serve'
actionpack (5.0.0.1) lib/action_dispatch/routing/route_set.rb:725:in `call'
rack-pjax (1.0.0) lib/rack/pjax.rb:12:in `call'
remotipart (1.3.1) lib/remotipart/middleware.rb:32: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 `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'
actionpack (5.0.0.1) lib/action_dispatch/middleware/cookies.rb:613:in `call'
activerecord (5.0.0.1) lib/active_record/migration.rb:552:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:38:in `block in call'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:97:in `__run_callbacks__'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:750:in `_run_call_callbacks'
activesupport (5.0.0.1) lib/active_support/callbacks.rb:90:in `run_callbacks'
actionpack (5.0.0.1) lib/action_dispatch/middleware/callbacks.rb:36:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/remote_ip.rb:79:in `call'
better_errors (2.1.1) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (2.1.1) lib/better_errors/middleware.rb:57:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/debug_exceptions.rb:49:in `call'
web-console (3.4.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.4.0) lib/web_console/middleware.rb:28:in `block in call'
web-console (3.4.0) lib/web_console/middleware.rb:18:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
railties (5.0.0.1) lib/rails/rack/logger.rb:36:in `call_app'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `block in call'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `block in tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (5.0.0.1) lib/active_support/tagged_logging.rb:70:in `tagged'
railties (5.0.0.1) lib/rails/rack/logger.rb:24:in `call'
sprockets-rails (3.2.0) lib/sprockets/rails/quiet_assets.rb:13:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/request_id.rb:24: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'
activesupport (5.0.0.1) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/executor.rb:12:in `call'
actionpack (5.0.0.1) lib/action_dispatch/middleware/static.rb:136:in `call'
rack (2.0.1) lib/rack/sendfile.rb:111:in `call'
railties (5.0.0.1) lib/rails/engine.rb:522:in `call'
puma (3.6.0) lib/puma/configuration.rb:225:in `call'
puma (3.6.0) lib/puma/server.rb:578:in `handle_request'
puma (3.6.0) lib/puma/server.rb:415:in `process_client'
puma (3.6.0) lib/puma/server.rb:275:in `block in run'
puma (3.6.0) lib/puma/thread_pool.rb:116:in `block in spawn_thread'
Started POST "/admin/__better_errors/d8e9adcf6cf62efb/variables" for ::1 at 2017-01-24 23:16:58 -0500
这是我们的仪表板模型。
class Dashboard < ApplicationRecord
end
这是我们的架构。
ActiveRecord::Schema.define(version: 20170116124600) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "assignments", force: :cascade do |t|
t.integer "store_id"
t.integer "category_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["category_id"], name: "index_assignments_on_category_id", using: :btree
t.index ["store_id"], name: "index_assignments_on_store_id", using: :btree
end
create_table "categories", force: :cascade do |t|
t.string "name"
t.string "description"
end
create_table "comments", force: :cascade do |t|
t.text "content"
t.integer "post_id"
t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["post_id"], name: "index_comments_on_post_id", using: :btree
t.index ["user_id"], name: "index_comments_on_user_id", using: :btree
end
create_table "follows", force: :cascade do |t|
t.integer "follower_id"
t.integer "followed_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["followed_id"], name: "index_follows_on_followed_id", using: :btree
t.index ["follower_id", "followed_id"], name: "index_follows_on_follower_id_and_followed_id", unique: true, using: :btree
t.index ["follower_id"], name: "index_follows_on_follower_id", using: :btree
end
create_table "friendships", force: :cascade do |t|
t.integer "user_id"
t.integer "friend_id"
t.boolean "accepted", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["user_id", "friend_id"], name: "index_friendships_on_user_id_and_friend_id", unique: true, using: :btree
end
create_table "posts", force: :cascade do |t|
t.string "title"
t.text "content"
t.string "image"
t.integer "store_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "type"
t.datetime "start"
t.datetime "end"
t.string "info"
t.string "info2"
t.string "link"
t.index ["store_id", "created_at"], name: "index_posts_on_store_id_and_created_at", unique: true, using: :btree
end
create_table "reviews", force: :cascade do |t|
t.string "title"
t.text "review_text"
t.integer "rating"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
t.integer "store_id"
t.index ["store_id"], name: "index_reviews_on_store_id", using: :btree
t.index ["user_id"], name: "index_reviews_on_user_id", using: :btree
end
create_table "searches", force: :cascade do |t|
t.string "keywords"
t.string "category"
t.integer "min_price"
t.integer "max_price"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "stores", force: :cascade do |t|
t.string "store_name"
t.string "company_name"
t.string "image"
t.string "email"
t.string "store_link"
t.integer "price_rating", default: 0
t.string "contact_number"
t.string "contact_number_int"
t.string "contact_email"
t.string "contact_form_link"
t.string "feedback_email"
t.string "slogan"
t.string "address1"
t.string "address2"
t.string "city"
t.string "state"
t.string "zipcode"
t.string "country", default: "USA"
t.string "founded_date"
t.text "short_description"
t.text "long_description"
t.string "facebook_link"
t.string "twitter_link"
t.string "instagram_link"
t.string "google_plus_link"
t.string "pinterest_link"
t.float "latitude"
t.float "longitude"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "reviews_id"
t.string "shipping"
t.index ["reviews_id"], name: "index_stores_on_reviews_id", using: :btree
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "first_name"
t.string "middle_initial"
t.string "last_name"
t.date "birthday"
t.text "bio"
t.string "occupation"
t.string "motto"
t.string "website_link"
t.string "hometown"
t.boolean "is_male", default: true
t.integer "reviews_id"
t.boolean "admin", default: false
t.string "avatar"
t.integer "store_id"
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
t.index ["reviews_id"], name: "index_users_on_reviews_id", using: :btree
t.index ["store_id"], name: "index_users_on_store_id", using: :btree
end
add_foreign_key "comments", "posts"
add_foreign_key "comments", "users"
add_foreign_key "posts", "stores"
add_foreign_key "stores", "reviews", column: "reviews_id"
add_foreign_key "users", "reviews", column: "reviews_id"
end
我相信这是必须手动重新创建的空模型。有什么方法可以再次为 rails_admin 生成所需的仪表板模型和迁移,因为它们已被删除或覆盖?如果需要更多信息,请告诉我。