How to use the Rails Console
-
According to https://dawarich.app/docs/FAQ I want to do some datapoint cleaning:
- https://dawarich.app/docs/FAQ#how-to-enter-dawarich-console enter the Rails Console, as the app terminal is already in docker I did:
bin/rails consoleand entered "something"
/app/code# bin/rails console [dotenv] Set DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT, REDIS_URL, and OBJC_DISABLE_INITIALIZE_FORK_SAFETY [dotenv] Loaded .env.development OIDC: Not configured (missing OIDC_CLIENT_ID or OIDC_CLIENT_SECRET) Loading development environment (Rails 8.0.3) [1] pry(main)>[1] pry(main)> points = Point.where(latitude: 0, longitude: 0) ActiveRecord::ConnectionNotEstablished: connection to server at "::1", port 5432 failed: Connection refused (ActiveRecord::ConnectionNotEstablished) Is the server running on that host and accepting TCP/IP connections? connection to server at "127.0.0.1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? from /app/code/vendor/bundle/ruby/3.4.0/gems/activerecord-8.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:69:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new_client' Caused by PG::ConnectionBad: connection to server at "::1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? connection to server at "127.0.0.1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? from /app/code/vendor/bundle/ruby/3.4.0/gems/pg-1.6.2-x86_64-linux/lib/pg/connection.rb:751:in 'PG::Connection::Pollable#polling_loop' [2] pry(main)>Now the question is how to get this working? There are many more "tools" via this Console but it has to work in the first place

- https://dawarich.app/docs/FAQ#how-to-enter-dawarich-console enter the Rails Console, as the app terminal is already in docker I did:
-
@nebulon same results, tried console and dbconsole
root@8c0ca5cc-f129-4fb3-9de3-4b308caacb38:/app/code# bundle exec rails Usage: bin/rails COMMAND [options] You must specify a command. The most common commands are: generate Generate new code (short-cut alias: "g") console Start the Rails console (short-cut alias: "c") server Start the Rails server (short-cut alias: "s") test Run tests except system tests (short-cut alias: "t") test:system Run system tests dbconsole Start a console for the database specified in config/database.yml (short-cut alias: "db") plugin new Create a new Rails railtie or engine All commands can be run with -h (or --help) for more information. root@8c0ca5cc-f129-4fb3-9de3-4b308caacb38:/app/code# bundle exec rails console [dotenv] Set DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT, REDIS_URL, and OBJC_DISABLE_INITIALIZE_FORK_SAFETY [dotenv] Loaded .env.development OIDC: Not configured (missing OIDC_CLIENT_ID or OIDC_CLIENT_SECRET) Loading development environment (Rails 8.0.3) [1] pry(main)> points = Point.where(latitude: 0, longitude: 0) ActiveRecord::ConnectionNotEstablished: connection to server at "::1", port 5432 failed: Connection refused (ActiveRecord::ConnectionNotEstablished) Is the server running on that host and accepting TCP/IP connections? connection to server at "127.0.0.1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? from /app/code/vendor/bundle/ruby/3.4.0/gems/activerecord-8.0.3/lib/active_record/connection_adapters/postgresql_adapter.rb:69:in 'ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.new_client' Caused by PG::ConnectionBad: connection to server at "::1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? connection to server at "127.0.0.1", port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? from /app/code/vendor/bundle/ruby/3.4.0/gems/pg-1.6.2-x86_64-linux/lib/pg/connection.rb:751:in 'PG::Connection::Pollable#polling_loop' [2] pry(main)> exit root@8c0ca5cc-f129-4fb3-9de3-4b308caacb38:/app/code# bundle exec rails dbconsole [dotenv] Set DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT, REDIS_URL, and OBJC_DISABLE_INITIALIZE_FORK_SAFETY [dotenv] Loaded .env.development OIDC: Not configured (missing OIDC_CLIENT_ID or OIDC_CLIENT_SECRET) psql: error: connection to server at "localhost" (::1), port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused Is the server running on that host and accepting TCP/IP connections? root@8c0ca5cc-f129-4fb3-9de3-4b308caacb38:/app/code# -
Hello @imc67
We have added a doc section for the rails console.
https://docs.cloudron.io/packages/dawarich/#rails-console -
I imc67 has marked this topic as solved on
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login
