kandi background
Explore Kits

rails | Ruby on Rails | Application Framework library

 by   rails Ruby Version: v5.2.7 License: MIT

 by   rails Ruby Version: v5.2.7 License: MIT

Download this library from

kandi X-RAY | rails Summary

rails is a Ruby library typically used in Server, Application Framework, Ruby On Rails applications. rails has a Permissive License and it has medium support. However rails has 94 bugs and it has 5 vulnerabilities. You can download it from GitHub.
Ruby on Rails
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • rails has a medium active ecosystem.
  • It has 50532 star(s) with 20269 fork(s). There are 2423 watchers for this library.
  • There were 10 major release(s) in the last 12 months.
  • There are 357 open issues and 15148 have been closed. On average issues are closed in 65 days. There are 240 open pull requests and 0 closed requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of rails is v5.2.7
rails Support
Best in #Application Framework
Average in #Application Framework
rails Support
Best in #Application Framework
Average in #Application Framework

quality kandi Quality

  • rails has 94 bugs (0 blocker, 0 critical, 78 major, 16 minor) and 3685 code smells.
rails Quality
Best in #Application Framework
Average in #Application Framework
rails Quality
Best in #Application Framework
Average in #Application Framework

securitySecurity

  • rails has 5 vulnerability issues reported (1 critical, 1 high, 3 medium, 0 low).
  • rails code analysis shows 0 unresolved vulnerabilities.
  • There are 167 security hotspots that need review.
rails Security
Best in #Application Framework
Average in #Application Framework
rails Security
Best in #Application Framework
Average in #Application Framework

license License

  • rails is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
rails License
Best in #Application Framework
Average in #Application Framework
rails License
Best in #Application Framework
Average in #Application Framework

buildReuse

  • rails releases are available to install and integrate.
  • Installation instructions, examples and code snippets are available.
  • It has 312091 lines of code, 32268 functions and 3616 files.
  • It has medium code complexity. Code complexity directly impacts maintainability of the code.
rails Reuse
Best in #Application Framework
Average in #Application Framework
rails Reuse
Best in #Application Framework
Average in #Application Framework
Top functions reviewed by kandi - BETA

kandi has reviewed rails and discovered the below as its top functions. This is intended to give you an instant insight into rails implemented functionality, and help decide if they suit your requirements.

  • Start the database connection
  • Execute a single column for a specific column
  • Parses a template and returns the options hash .
  • Renders the thread as well asynchronously .
  • Returns associations for this association
  • Generate the layout for the given user .
  • Creates a new message .
  • Renders the value to a tag .
  • Returns true if the masked token is valid .
  • Returns an array of between two ranges .

rails Key Features

Ruby on Rails

Getting Started

copy iconCopydownload iconDownload
 $ gem install rails

psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory

copy iconCopydownload iconDownload
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14
$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#
port = 5432
$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
-----------------------
brew uninstall postgresql
brew install postgresql@13
brew services start postgresql@13
brew link postgresql@13 --force
-----------------------
rm /opt/homebrew/var/postgres/postmaster.pid
brew services restart postgresql
-----------------------
brew postgresql-upgrade-database
brew install postgresql
brew postgresql-upgrade-database
-----------------------
brew postgresql-upgrade-database
brew install postgresql
brew postgresql-upgrade-database

Selenium-chromedriver: Cannot construct KeyEvent from non-typeable key

copy iconCopydownload iconDownload
driver.find_element('.email-input', 'user@mail.com')
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

emailParts = 'user@mail.com'.split('@')
emailElement = driver.find_element('.email-input')

emailElement.send_keys(emailParts[0])
action = ActionChains(driver)
action.key_down(Keys.ALT).send_keys('2').key_up(Keys.ALT).perform()
emailElement.send_keys(emailParts[1])
-----------------------
driver.find_element('.email-input', 'user@mail.com')
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

emailParts = 'user@mail.com'.split('@')
emailElement = driver.find_element('.email-input')

emailElement.send_keys(emailParts[0])
action = ActionChains(driver)
action.key_down(Keys.ALT).send_keys('2').key_up(Keys.ALT).perform()
emailElement.send_keys(emailParts[1])
-----------------------
# /test/support/system/capybara_config.rb
require 'webdrivers/chromedriver'
Webdrivers::Chromedriver.required_version = '97.0.4692.71'

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase

  # overriding the `fill_in` helper for filling in strings with an `@` symbol
  def fill_in(locator = nil, with:, currently_with: nil, fill_options: {}, **find_options)
    return super unless with.include? "@"

    find_options[:with] = currently_with if currently_with
    find_options[:allow_self] = true if locator.nil?
    element = find(:fillable_field, locator, **find_options)
    email_front, email_back = with.split("@")

    element.send_keys(email_front)
    page.driver.browser.action
        .key_down(Selenium::WebDriver::Keys[:alt])
        .send_keys('g')
        .key_up(Selenium::WebDriver::Keys[:alt])
        .perform
    element.send_keys(email_back)
  end
end
-----------------------
# /test/support/system/capybara_config.rb
require 'webdrivers/chromedriver'
Webdrivers::Chromedriver.required_version = '97.0.4692.71'

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase

  # overriding the `fill_in` helper for filling in strings with an `@` symbol
  def fill_in(locator = nil, with:, currently_with: nil, fill_options: {}, **find_options)
    return super unless with.include? "@"

    find_options[:with] = currently_with if currently_with
    find_options[:allow_self] = true if locator.nil?
    element = find(:fillable_field, locator, **find_options)
    email_front, email_back = with.split("@")

    element.send_keys(email_front)
    page.driver.browser.action
        .key_down(Selenium::WebDriver::Keys[:alt])
        .send_keys('g')
        .key_up(Selenium::WebDriver::Keys[:alt])
        .perform
    element.send_keys(email_back)
  end
end
-----------------------
 String arroba = Keys.chord(Keys.ALT, "2");

 String[] mailSplit = mail.split("@");

 userInput.sendKeys(mailSplit[0]);

 userInput.sendKeys(arroba);
 userInput.sendKeys(Keys.BACK_SPACE);

 userInput.sendKeys(mailSplit[1]);
-----------------------
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.by import By

def safe_send_keys(
    driver,
    input_selector: str,
    input_text: str,
    selector_type = By.CSS_SELECTOR
):
    driver.find_element(selector_type, input_selector).click()
    action = ActionChains(driver)
    action.send_keys(input_text)
    action.perform()

# Example
driver = webdriver.Chrome()
# ... Go to your web page
email = "email_with_at@email.com"
selector = "input_selector"
safe_send_keys(driver, selector, email)
-----------------------
 JavascriptExecutor jse = (JavascriptExecutor) getDriver();
 jse.executeScript("arguments[0].setAttribute('value', arguments[1])", googleEmailWebElement, email);
-----------------------
WebDriverManager.chromedriver().browserVersion("97").setup();
-----------------------
fill_in :user_email, with: user.email
def fill_in_chrome98_tmp_fix(locator, with:)
  element = find(:fillable_field, locator)
  dom_id = element.native.dom_attribute("id")
  raise "No DOM ID" if dom_id.blank?
  page.execute_script("document.getElementById('#{dom_id}').value = '#{with}'")
end
-----------------------
fill_in :user_email, with: user.email
def fill_in_chrome98_tmp_fix(locator, with:)
  element = find(:fillable_field, locator)
  dom_id = element.native.dom_attribute("id")
  raise "No DOM ID" if dom_id.blank?
  page.execute_script("document.getElementById('#{dom_id}').value = '#{with}'")
end
-----------------------
@classmethod
def setUpClass(cls):
    super().setUpClass()

    options = webdriver.ChromeOptions()
    options.add_argument('--no-sandbox')  # Must be the very first option
    options.add_argument('--headless')
    options.add_argument('--disable-gpu')
    options.add_argument('--disable-software-rasterizer')

    options.add_argument('--disable-dev-shm-usage')
    options.add_argument("--remote-debugging-port=9222")
    options.add_argument("--no-default-browser-check")
    options.add_argument("--no-first-run")
    options.add_argument("--disable-default-apps")

    s = Service(
        ChromeDriverManager(
            # version='98.0.4758.80',
            # version='98.0.4758.48',
            version='97.0.4692.71',
            log_level=logging.WARNING,
            chrome_type=ChromeType.CHROMIUM).install())

    cls.selenium = webdriver.Chrome(
        service=s,
        options=options)
    cls.selenium.implicitly_wait(1)

visit_Psych_Nodes_Alias: Unknown alias: default (Psych::BadAlias)

copy iconCopydownload iconDownload
begin
  YAML.load(source, aliases: true, **options)
rescue ArgumentError
  YAML.load(source, **options)
end
module YAML
  def self.properly_load_file(path)
    YAML.load_file path, aliases: true
  rescue ArgumentError
    YAML.load_file path
  end
end
module YAML
  class << self
    alias_method :load, :unsafe_load if YAML.respond_to? :unsafe_load
  end
end
gem 'psych', '< 4'
-----------------------
begin
  YAML.load(source, aliases: true, **options)
rescue ArgumentError
  YAML.load(source, **options)
end
module YAML
  def self.properly_load_file(path)
    YAML.load_file path, aliases: true
  rescue ArgumentError
    YAML.load_file path
  end
end
module YAML
  class << self
    alias_method :load, :unsafe_load if YAML.respond_to? :unsafe_load
  end
end
gem 'psych', '< 4'
-----------------------
begin
  YAML.load(source, aliases: true, **options)
rescue ArgumentError
  YAML.load(source, **options)
end
module YAML
  def self.properly_load_file(path)
    YAML.load_file path, aliases: true
  rescue ArgumentError
    YAML.load_file path
  end
end
module YAML
  class << self
    alias_method :load, :unsafe_load if YAML.respond_to? :unsafe_load
  end
end
gem 'psych', '< 4'
-----------------------
begin
  YAML.load(source, aliases: true, **options)
rescue ArgumentError
  YAML.load(source, **options)
end
module YAML
  def self.properly_load_file(path)
    YAML.load_file path, aliases: true
  rescue ArgumentError
    YAML.load_file path
  end
end
module YAML
  class << self
    alias_method :load, :unsafe_load if YAML.respond_to? :unsafe_load
  end
end
gem 'psych', '< 4'

&quot;nil can't be coerced into Integer&quot; when assign variable (only)

copy iconCopydownload iconDownload
bundle exec rails c -e production

Rails 7 - link_to with method :delete still performs GET request

copy iconCopydownload iconDownload
<%= link_to "Sign Out", destroy_user_session_path, data: { "turbo-method": :delete } %>
-----------------------
<%= button_to 'Sign Out', destroy_user_session_path, method: :delete %>
<%= link_to 'Sign Out', destroy_user_session_path, data: {turbo_method: :delete} %>
<%= button_to 'Sign Out', destroy_user_session_path, method: :delete,
  form: {data: {turbo_confirm: 'Are you sure?'}} %>
<%= link_to 'Sign Out', destroy_user_session_path,
  data: {turbo_method: :delete, turbo_confirm: 'Are you sure?'} %>
-----------------------
<%= button_to 'Sign Out', destroy_user_session_path, method: :delete %>
<%= link_to 'Sign Out', destroy_user_session_path, data: {turbo_method: :delete} %>
<%= button_to 'Sign Out', destroy_user_session_path, method: :delete,
  form: {data: {turbo_confirm: 'Are you sure?'}} %>
<%= link_to 'Sign Out', destroy_user_session_path,
  data: {turbo_method: :delete, turbo_confirm: 'Are you sure?'} %>
-----------------------
<%= button_to 'Sign Out', destroy_user_session_path, method: :delete %>
<%= link_to 'Sign Out', destroy_user_session_path, data: {turbo_method: :delete} %>
<%= button_to 'Sign Out', destroy_user_session_path, method: :delete,
  form: {data: {turbo_confirm: 'Are you sure?'}} %>
<%= link_to 'Sign Out', destroy_user_session_path,
  data: {turbo_method: :delete, turbo_confirm: 'Are you sure?'} %>
-----------------------
<%= button_to 'Sign Out', destroy_user_session_path, method: :delete %>
<%= link_to 'Sign Out', destroy_user_session_path, data: {turbo_method: :delete} %>
<%= button_to 'Sign Out', destroy_user_session_path, method: :delete,
  form: {data: {turbo_confirm: 'Are you sure?'}} %>
<%= link_to 'Sign Out', destroy_user_session_path,
  data: {turbo_method: :delete, turbo_confirm: 'Are you sure?'} %>

GET request processed as HTML rather than TURBO_STREAM from within turbo_frame_tag

copy iconCopydownload iconDownload
require("turbolinks").start()

Rails bundle install Could not find turbo-rails-7.1.1 in any of the sources

copy iconCopydownload iconDownload
gem 'turbo-rails', '~> 0.8'

Heroku fails during build with Error: Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (93)

copy iconCopydownload iconDownload
# In package.json
{
  # ...
  "engines": {
    "node": "14.x"
  },
  # ...
}
$ heroku buildpacks:add heroku/nodejs -i 1 -a YOUR-APP-NAME
-----------------------
# In package.json
{
  # ...
  "engines": {
    "node": "14.x"
  },
  # ...
}
$ heroku buildpacks:add heroku/nodejs -i 1 -a YOUR-APP-NAME

Error when trying to install devise in Ruby on Rails 7.0.0

copy iconCopydownload iconDownload
def self.ref(arg)
  ActiveSupport::Dependencies.reference(arg)
  Getter.new(arg)
end
-----------------------
gem 'devise', git: 'https://github.com/heartcombo/devise', branch: 'main'

Trying to import a CSV file triggers a function which ends up manipulating the data imported into the database

copy iconCopydownload iconDownload
class User < ApplicationRecord

  attr_accessor :skip_callbacks
  attr_accessor :skip_password_hashing
  validates :password, presence: true, unless: :skip_callbacks

  def password= password
    self[:password] = skip_password_hashing ? password : hash_password(password)
  end

  private
    
  def hash_password password
     Digest::MD5.hexdigest "#{Digest::MD5.hexdigest password}#{salt}"
  end
end
def import_users
  path = Rails.root.join('somePath')
  CSV.foreach(path, headers: true) do |row|
    usr = User.new(row.to_hash)
    usr.skip_password_hashing = true
    usr.save
  end
  puts "inserts on table users complete"
end
-----------------------
class User < ApplicationRecord

  attr_accessor :skip_callbacks
  attr_accessor :skip_password_hashing
  validates :password, presence: true, unless: :skip_callbacks

  def password= password
    self[:password] = skip_password_hashing ? password : hash_password(password)
  end

  private
    
  def hash_password password
     Digest::MD5.hexdigest "#{Digest::MD5.hexdigest password}#{salt}"
  end
end
def import_users
  path = Rails.root.join('somePath')
  CSV.foreach(path, headers: true) do |row|
    usr = User.new(row.to_hash)
    usr.skip_password_hashing = true
    usr.save
  end
  puts "inserts on table users complete"
end

Community Discussions

Trending Discussions on rails
  • psql: error: connection to server on socket &quot;/tmp/.s.PGSQL.5432&quot; failed: No such file or directory
  • Selenium-chromedriver: Cannot construct KeyEvent from non-typeable key
  • visit_Psych_Nodes_Alias: Unknown alias: default (Psych::BadAlias)
  • Attempting to register a user on my devise app causes undefined method `user_url' for #&lt;Devise::RegistrationsController:0x0000000000d9d0&gt;
  • Rails 7 asset pipeline SassC::SyntaxError with Tailwind
  • &quot;nil can't be coerced into Integer&quot; when assign variable (only)
  • Rails 7 - link_to with method :delete still performs GET request
  • GET request processed as HTML rather than TURBO_STREAM from within turbo_frame_tag
  • Type application/netcdf is already registered as a variant of application/netcdf
  • Rails 7 Ruby 3.1 LoadError: cannot load such file -- net/smtp
Trending Discussions on rails

QUESTION

psql: error: connection to server on socket &quot;/tmp/.s.PGSQL.5432&quot; failed: No such file or directory

Asked 2022-Apr-04 at 15:46

Not really sure what caused this but most likely exiting the terminal while my rails server which was connected to PostgreSQL database was closed (not a good practice I know but lesson learned!)

I've already tried the following:

  1. Rebooting my machine (using MBA M1 2020)
  2. Restarting PostgreSQL using homebrew brew services restart postgresql
  3. Re-installing PostgreSQL using Homebrew
  4. Updating PostgreSQL using Homebrew
  5. I also tried following this link but when I run cd Library/Application\ Support/Postgres terminal tells me Postgres folder doesn't exist, so I'm kind of lost already. Although I have a feeling that deleting postmaster.pid would really fix my issue. Any help would be appreciated!

ANSWER

Answered 2022-Jan-13 at 15:19

Resetting PostgreSQL

My original answer only included the troubleshooting steps below, and a workaround. I now decided to properly fix it via brute force by removing all clusters and reinstalling, since I didn't have any data there to keep. It was something along these lines, on my Ubuntu 21.04 system:

sudo pg_dropcluster --stop 12 main
sudo pg_dropcluster --stop 14 main
sudo apt remove postgresql-14
sudo apt purge postgresql*
sudo apt install postgresql-14

Now I have:

$ pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log

And sudo -u postgres psql works fine. The service was started automatically but it can be done manually with sudo systemctl start postgresql.

Incidentally, I can recommend the PostgreSQL docker image, which eliminates the need to bother with a local installation.

Troubleshooting

Although I cannot provide an answer to your specific problem, I thought I'd share my troubleshooting steps, hoping that it might be of some help. It seems that you are on Mac, whereas I am running Ubuntu 21.04, so expect things to be different.

This is a client connection problem, as noted by section 19.3.2 in the docs.

The directory in my error message is different:

$ sudo su postgres -c "psql"
psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

I checked what unix sockets I had in that directory:

$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock

Makes sense, there is a socket for 5433 not 5432. I confirmed this by running:

$ pg_lsclusters
Ver Cluster Port Status                Owner    Data directory              Log file
12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log

This explains how it got into this mess on my system. The default port is 5432, but after I upgraded from version 12 to 14, the server was setup to listen to 5433, presumably because it considered 5432 as already taken. Two alternatives here, get the server to listen on 5432 which is the client's default, or get the client to use 5433.

Let's try it by changing the client's parameters:

$ sudo su postgres -c "psql --port=5433"
psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
Type "help" for help.

postgres=#

It worked! Now, to make it permanent I'm supposed to put this setting on a psqlrc or ~/.psqlrc file. The thin documentation on this (under "Files") was not helpful to me as I was not sure on the syntax and my attempts did not change the client's default, so I moved on.

To change the server I looked for the postgresql.conf mentioned in the documentation but could not find the file. I did however see /var/lib/postgresql/14/main/postgresql.auto.conf so I created it on the same directory with the content:

port = 5432

Restarted the server: sudo systemctl restart postgresql

But the error persisted because, as the logs confirmed, the port did not change:

$ tail /var/log/postgresql/postgresql-14-main.log
...
2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections

After other attempts did not succeed, I eventually decided to use a workaround: to redirect the client's requests on 5432 to 5433:

ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432

This is what I have now:

$ ls -lah /var/run/postgresql/
total 8.0K
drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
-rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
-rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock

This means I can now just run psql without having to explicitly set the port to 5433. Now, this is a hack and I would not recommend it. But in my development system I am happy with it for now, because I don't have more time to spend on this. This is why I shared the steps and the links so that you can find a proper solution for your case.

Source https://stackoverflow.com/questions/69754628

Community Discussions, Code Snippets contain sources that include Stack Exchange Network

Vulnerabilities

No vulnerabilities reported

Install rails

Install Rails at the command prompt if you haven't yet:.
Install Rails at the command prompt if you haven't yet: $ gem install rails
At the command prompt, create a new Rails application: $ rails new myapp where "myapp" is the application name.
Change directory to myapp and start the web server: $ cd myapp $ bin/rails server Run with --help or -h for options.
Go to http://localhost:3000 and you'll see the Rails bootscreen with your Rails and Ruby versions.
Follow the guidelines to start developing your application. You may find the following resources handy: Getting Started with Rails Ruby on Rails Guides The API Documentation

Support

We encourage you to contribute to Ruby on Rails! Please check out the Contributing to Ruby on Rails guide for guidelines about how to proceed. Join us!. Trying to report a possible security vulnerability in Rails? Please check out our security policy for guidelines about how to proceed. Everyone interacting in Rails and its sub-projects' codebases, issue trackers, chat rooms, and mailing lists is expected to follow the Rails code of conduct.

DOWNLOAD this Library from

Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

Share this Page

share link
Consider Popular Application Framework Libraries
Compare Application Framework Libraries with Highest Support
Compare Application Framework Libraries with Highest Quality
Compare Application Framework Libraries with Highest Reuse
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
over 430 million Knowledge Items
Find more libraries
Reuse Solution Kits and Libraries Curated by Popular Use Cases

Save this library and start creating your kit

  • © 2022 Open Weaver Inc.