Ruby · 21 Apr 2022

How to create custom Error with passing data

Sometimes raising error is not enough. As probably you know, you can use command like this:

raise ActiveModel::StrictValidationFailed, "Some message"

This command will return 500 error on your website + it will log into your console the name of the error and message you passed in.

But it won't give you any context. This is big problem if for example you call API and your response is bad.
You want to know, what is happening there directly.

Fortunately there is some solution for it.

Read more
Ruby · 06 Apr 2022

gitlab, github - Permission denied (publickey,keyboard-interactive)

Today i've suffered some issue with a SSH key. I've tried to clone my repository from Gitlab.com.

Unfortunately i've received an error:

Permission denied (publickey,keyboard-interactive)

I've thought, i have problem with a SSH key. Unfortunately, adding a SSH key did not resolve the problem.

How to resolve it?

Read more
Ruby · 12 Jan 2022

How to work with Searchkick gem - Elasticsearch

Elasticsearch is just an amazing search engine with a lot of flexibility.

You can think, that working with this tool is very hard, but actually, it is not.

Today I will show you, how to use Elasticsearch through the Searchkick gem.

Read more
Ruby · 20 Dec 2021

How to copy folder from SSH to local

Copying data from ssh to local is not that hard:

scp -r admin@servername.com:domains/domain-name.pl/public_html/admin/backups admin/backups

This is how to copy from local to remote:

scp /Downloads/example_file.txt admin@servername.com:domains/domain-name.pl/public_html/admin/backups

You can use "-r" flag to copy full folder. Without this you can copy only one file.

Ruby · 07 Dec 2021

Kill your ruby session

Quick cheatsheet to kill your Rails session on port 3000

kill -9 $(lsof -i tcp:3000 -t)