If you ever have the need to play with SAML SSO or SAML Single Sign-On integrations in Ruby, feel free to take a look at this gist :) ...
If you ever have the need to play with SAML SSO or SAML Single Sign-On integrations in Ruby, feel free to take a look at this gist :) ...
Here you have a quick example: Let's begin with the service for that. app/services/format_response_with_active_model_errors.rb [ruby] class FormatResponseWithActiveModelErrors extend ActiveModel::Naming def initialize @errors = ActiveModel::Errors.new(self) end def valid? errors.empty? end attr_reader :errors attr_accessor :response def add_error_message!(field_name:,...
Oftentimes, when you want to run a script in a remote server, you work on that script and then you are having troubles to copy-paste that class, service or method, so in order to not have copy-paste troubles you can do something as follow You can...
Sometimes, you need to debug an error with assets generation y/o in the context of production environment, for such cases, here, I'm sharing a few steps you can follow in order to run your Rails application in production mode. Prepare your https/ssl certificates: [shell] openssl req -x509 -sha256...
In case you are having troubles to use the [ruby] expect_any_instance_of [/ruby] From Rspec, guess what, it is not only you, many of us have faced the same troubles before, you can see it here in the thread discussion https://github.com/rspec/rspec-mocks/issues/910 I really agree with this argument: The name of the method...
First of all, in some cases, the time spent in that query is really low so maybe, a good way to see if you can improve it is to compare that functionality with the same query after making some tweaks, such as lazy loading, using...
Let's say you want to see where it is declared the method `last` from ActiveRecord, you can do so Just as simple as: [ruby] MyModel.method(:last).source_location [/ruby] There you go...
Ahora una triste historia para programadores/arquitectos de software: Erase una vez una clase llamada `God` la cual implementaba el método `create_planet` [ruby] Class God def self.create_planet Earth.new end end [/ruby] Cierto día fue invocada por primera vez [ruby] @earth = God.create_planet [/ruby] La instancia Earth(Tierra) era maravillosa y resplandeciente, llena...
A really simple retry when exceptions happen in Ruby on Rails as in this example I'm using a `find_by` from ActiveRecord ORM. [ruby] @tries = 5 def find_this_guy sleep 5 my_record = MyModel.find_by!(id: 66, other_boolean_field: true) ...
Do you want to start learning Android Java with the right foot? If you are a beginner starting with Android Java, I would highly recommend you to study and practice this incredible series of videos as you will start with the right foot and doing TDD!!! First...