postgresql Rails 7.0.5在生成用户scaffold之后,但在打开服务器之后,我遇到了一个缺少模板的错误

flvtvl50  于 2023-06-29  发布在  PostgreSQL
关注(0)|答案(1)|浏览(96)

Rails 7.0.5我生成了一个scaffold,它应该为我创建所有内容,当我打开服务器时,它说缺少模板,我不明白,但当我打开视图检查文件时,所有内容都是正确的,控制器名称与我在视图中的名称相同,我能知道问题是什么吗?或者我应该怎么做?我已经创建和删除应用程序几次,并运行scaffold命令来生成用户,甚至更进一步,我尝试了一些像帖子和一切,但一直有失踪的模板。
我创建了一个app:rails new blogposts --database=postgresql
我删除了应用程序,重新创建了它,并运行命令:rails生成scaffold用户名:string邮箱:string电话:string

5cg8jx4n

5cg8jx4n1#

我试着运行我这边的命令来检查我是否能得到同样的结果,这就是我得到的。它工作得很完美:

(0.6ms)  SELECT pg_try_advisory_lock(6659919153272268975)
  ActiveRecord::SchemaMigration Pluck (0.8ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Migrating to CreateUsers (20230628090844)
== 20230628090844 CreateUsers: migrating ======================================
-- create_table(:users)
  TRANSACTION (0.4ms)  BEGIN
   (59.3ms)  CREATE TABLE "users" ("id" bigserial primary key, "name" character varying, "email" character varying, "phone" character varying, "created_at" timestamp(6) NOT NULL, "updated_at" timestamp(6) NOT NULL)
   -> 0.0636s
== 20230628090844 CreateUsers: migrated (0.0638s) =============================

  ActiveRecord::SchemaMigration Create (0.8ms)  INSERT INTO "schema_migrations" ("version") VALUES ($1) RETURNING "version"  [["version", "20230628090844"]]
  TRANSACTION (36.6ms)  COMMIT
  ActiveRecord::InternalMetadata Load (12.4ms)  SELECT "ar_internal_metadata".* FROM "ar_internal_metadata" WHERE "ar_internal_metadata"."key" = $1 LIMIT $2  [["key", "environment"], ["LIMIT", 1]]
  TRANSACTION (0.4ms)  BEGIN
  ActiveRecord::InternalMetadata Create (0.9ms)  INSERT INTO "ar_internal_metadata" ("key", "value", "created_at", "updated_at") VALUES ($1, $2, $3, $4) RETURNING "key"  [["key", "environment"], ["value", "development"], ["created_at", "2023-06-28 09:09:15.830341"], ["updated_at", "2023-06-28 09:09:15.830341"]]
  TRANSACTION (24.4ms)  COMMIT
   (0.7ms)  SELECT pg_advisory_unlock(6659919153272268975)
  ActiveRecord::SchemaMigration Pluck (0.6ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Started GET "/" for 127.0.0.1 at 2023-06-28 11:09:15 +0200
  ActiveRecord::SchemaMigration Pluck (0.5ms)  SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
Processing by Rails::WelcomeController#index as HTML
  Rendering /home/piercel/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.5.1/lib/rails/templates/rails/welcome/index.html.erb
  Rendered /home/piercel/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.5.1/lib/rails/templates/rails/welcome/index.html.erb (Duration: 3.2ms | Allocations: 303)
Completed 200 OK in 23ms (Views: 6.1ms | ActiveRecord: 0.0ms | Allocations: 2873)

命令:rails about给予以下内容:

About your application's environment
Rails version             7.0.5.1
Ruby version              ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
RubyGems version          3.3.7
Rack version              2.2.7
Middleware                ActionDispatch::HostAuthorization, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActionDispatch::ServerTiming, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, ActionDispatch::ActionableExceptions, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, ActionDispatch::PermissionsPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper
Application root          /home/piercel/blogposts
Environment               development
Database adapter          postgresql
Database schema version   20230628090844

相关问题