Quantcast
Channel: EquiValent
Browsing all 112 articles
Browse latest View live

Rails 5.2 credentials cheat cheat

Rails introduced “encrypted” credentials from Rails version 5.2:https://www.engineyard.com/blog/rails-encrypted-credentials-on-rails-5.2https://guides.rubyonrails.org/5_2_release_notes.htmlIn order to...

View Article


Ruby on Rails Active Storage how to change host for url_for

Given you use Rails 5.2 Active Storage for file uploads# app/models/account.rb class Account < ActiveRecord::Base has_one_attached :avatar end # rails console a = Account.create a.avatar.attach(io:...

View Article


Factory Bot trait for attaching Active Storange has_attached

How to add Active Storage attachement as a Factory Bot (or Factory Girl) trait.technology used in the example: Rails 5.2.0, Ruby 2.5, Factory Bot 4.10, RSpec 3.7# app/models/account.rb class Account...

View Article

Image may be NSFW.
Clik here to view.

Back to the primitive. Testing with simplicity

In Ruby on Rails imagine that your controller is generating this JSON API:# app/controller/users_controller.rb class UsersController < ApplicationController def show @user = User.find(params[:id])...

View Article

Convert string “true” and string “false” to boolean with Rails

Rails 5ActiveModel::Type::Boolean.new.cast('t') # => true ActiveModel::Type::Boolean.new.cast('true') # => true ActiveModel::Type::Boolean.new.cast(true) # => true...

View Article


How to configure RSpec in Ruby on Rails

Article for Junior developers on how to set up: Rails 5.2, RSpec 3.7, Factory Bot, Database CleanerArticle was written 2018-08-09 and applies for current versions of gemsConfigure fresh projectI’m...

View Article

Ruby logs and puts not shown in docker container logs

Capturing Rails (or plain Ruby) logs in Docker logs output is needed when you are configuring some log agregation tool like Kibana that will proces logs directly from Docker container output.Given you...

View Article

Image may be NSFW.
Clik here to view.

Metaprogramming Ruby cheatcheat

This is a collection of Metaprogramming Ruby copy-paste examples.Metaprogramming is gentle art of writing code that defines/writes other code.Article was published 2018-08-23 and examples were tried...

View Article


Is Rails still relevant in 2018 ?

Article in progress … sorry for confusion

View Article


Google Maps in Rails with Coffee Script

First generate Google API tokengo to https://console.cloud.google.com/google/maps-apis/overviewcreate a project / open a porject from top menugenerate API key for “Maps JavaScript API”in the...

View Article

Image may be NSFW.
Clik here to view.

Ruby Sinatra on AWS Lambda

29.11.2018 AWS Lambda announced official Ruby Support. That means we all can build Serverless applications (or FaaS scripts) with the language that we love.AWS in the same article also provided quite...

View Article

How to upload remote file from url with ActiveStorage Rails

class Medium < ActiveRecord::Base has_one_attached :image end Attach remote filewith ‘require open-uri’require 'open-uri' file = open('https://eq8.eu/some-image.jpg') medium = Medium.last...

View Article

Exporting and Importing large amount of data in Rails

Couple of days ago my colleague and I we were creating export / import script to migrate several hundred thousand records and associated relations from one Ruby on Rails application to another Ruby on...

View Article


Image may be NSFW.
Clik here to view.

Duck Typing in Rails

Article is still in progress, I’m planing to release it by end of the weakIn programming there is a powerful concept called “Duck Type”Duck typing in computer programming is an application of the duck...

View Article

2019 set up Ubuntu 18.04 for Ruby on Rails developer (Cheatsheet)

in Nov 2016 I’ve published article Setup Ubuntu 16.04 for Ruby on Rails app (Cheatsheet) and it was quite a hit. As I’m reinstalling by Lenovo with fresh Ubuntu 18.04 I’ve decided to write up fresh...

View Article


Cinnamon workspaces for productivity development

step 1 - increase the number of workspacesdefault numper of workspaces in Cinnamon is 4 (I need 6)gsettings set org.cinnamon.desktop.wm.preferences num-workspaces 6 step 2 - Shortucuts for switching...

View Article

Image may be NSFW.
Clik here to view.

Visualized desktop workspaces flow

In this article I will show you what is in my opinion the most productive way how to work with your desktop environment.It is about using existing tool currently available in most of the operating...

View Article


Securely transfering files to server

Many times developer needs to copy over database dump or some migration csv file containing data to server. Easiest way is to just do scp but sometimes you are not able to do that due to firewall...

View Article

How to convert mkv to mp4

Given on Ubuntu 18.04ffmpeg -i vokoscreen-2019-03-21_07-45-03.mkv -codec copy output.mp4 source: https://askubuntu.com/questions/50433/how-to-convert-mkv-file-into-mp4-file-losslessly

View Article

How to test if ActiveJob job was enqueued in Rails RSpec

If you are looking for How to tell RSpec to execute queued jobs pls check this noteGiven you are using RSpec Rails gemIf you want to check if code enqueued specific jobs you can do class SomeController...

View Article
Browsing all 112 articles
Browse latest View live