guluc3m / gul-gultalks

GUL UC3M Technical Conferences Management System
http://cursos.gul.es
Other
6 stars 8 forks source link

BCrypt::Errors::InvalidHash: invalid hash when running db:seed #66

Open metroid2010 opened 3 years ago

metroid2010 commented 3 years ago

On latest commit, development branch (default).

Tried bundle install bin/rails db:migrate bin/rails db:seed as per the instructions in the README.md

Got:

Invoke db:load_config (first_time) Execute db:load_config ** Execute db:abort_if_pending_migrations /usr/lib/ruby/gems/2.7.0/gems/activerecord-5.1.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:30: warning: rb_check_safe_obj will be removed in Ruby 3.0 rake aborted! BCrypt::Errors::InvalidHash: invalid hash Traceback (most recent call last): bin/rake: invalid hash (BCrypt::Errors::InvalidHash) bin/rake: undefined method `reject' for nil:NilClass (NoMethodError)

Then, when launching the server with rails server, the page displays this error:

ActionView::Template::Error at /conferences uninitialized constant ActionView::CompiledTemplates::ARG

I guest this last error is because it's trying to fetch conferences from db/development.sql, which has the tables created, but not populated (because db:seed failed).

Any ideas what could be the cause?

metroid2010 commented 3 years ago

Update: Bcrypt does not throw an error when reverting 495ed4840c5e4ce96e74141e01db5e3d332924ae development.sql gets created successfully, but when running the server, errors are throw, I guess because something changed in the db format.

Patataman commented 3 years ago

Ignorando las versiones del Gemfile.lock (aka, te cargas el gemfile.lock y le das al bundle install), actualizando Bitly a >= 2 y apañando un poco las cosas, siguiendo lo del readme para desplegar development funciona, luego no carga porque al parecer faltan cosas en bbdd, o eso creo.

Por otro lado, la versión de producción a mi tampoco me ha funcionado ya que parece que se necesita tener rvm (https://rvm.io/) y yo no lo tenía y he sido incapaz de instalarlo en debian

Patataman commented 3 years ago
  1. Instalar RVM

Instalar RVM es un infierno: https://rvm.io/rvm/install#explained Probablemente haya que cambiar el path del rvm_path por tu propio home con export rvm_path=$HOME/rvm para evitar problemas de sudo, conflictos y basuras de ruby

1.1 Pon en tu .bashrc la línea export rvm_path=$HOME/rvm al final, porque se va a resetear cada vez que inicies una terminal/sesión

  1. Instalar Ruby 2.7.0

Una vez instalado RVM se puede instalar ruby con rvm install 2.7.0

  1. Clonarse gul-talks
  2. Borrar el Gemfile.lock,
  3. rvm use ruby para utilizar el ruby que has instalado con rvm
  4. Seguir el README, instalando las dependencias que diga que hacen falta, como mysql o sqllite 6.1 bundle install --without production 6.2 Esperas medio año a que acabe 6.3 mkdir app/assets/config && touch app/assets/config/manifest.js 6.4 Reemplaza la versión de Bitly en el Gemfile.lock por esto y repite el paso 6.1
    bitly (1.1.0)
      httparty (>= 0.7.6)
      multi_json (~> 1.3)
      oauth2 (>= 0.5.0, < 2.0)

6.5 rake db:migrate 6.6 rake db:seed 6.7 rails server 6.8 Disfruta de este error

imagen