Skip to content

Instantly share code, notes, and snippets.

View renatamarques97's full-sized avatar

Renata Marques renatamarques97

  • Qulture.rocks
  • Teresina, PI
View GitHub Profile
developer guide
@renatamarques97
renatamarques97 / setup-minerx-enableable-error.md
Last active March 16, 2020 19:12
setup minerx possible error on docker (minerx_web_1 exited with code 1)

After default setup

If this message appears app/models/concerns/enableable.rb:26:in raise_attribute_missing_error: tried to include Enableable concern, but this class (RuntimeError), and then minerx_web_1 exited with code 1, this occurs because of enableable, it allows a model to be activated, but doesn't have a column in the bank yet, so it breaks.

first, comment everything about enableable, and then:

bin/rails db:environment:set RAILS_ENV=development

Rolling Back After the End of a Session

$ rails console --sandbox"

Retrieving the Previous Execution Value

>> Game.all.map(&:name)
=> ["zelda", "mario", "gta"]
>> names = _

Install Jest

yarn add --dev jest

on package.json

"scripts": {
  "test": "jest"
},

if this message appears: psql: FATAL: database “<user>” does not exist create database first createdb

and then

enter pg command line

psql -U 

If this message:

> psql
psql: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.PGSQL.5432"?

or this message appears:

add a new line in .gitignore

/coverage

add this in Gemfile

group :test do
  gem 'simplecov', require: false
end
a = []
30.times { a << {} }
(1..30).map { |x| {} }

bonus:

find the two factor(type app) of the first member and stock in a variable

tf = Member.first.two_factors.find_by(type: "TwoFactor::App")

set activated attribute as true

tf.activated = true

an example using LIKE

'abc' LIKE 'abc'    true
'abc' LIKE 'a%'     true
'abc' LIKE '_b_'    true
'abc' LIKE 'c'      false

similar to (regular expression)