instance_eval though the names are similar but have rather counterintuitive behaviour.
A simple explanation to each is:
ClassName.class_eval: It’s used to define an instance method on a class object which applies on all the instances of the class.
ClassName.instance_eval: It’s used to define a class…
What is STI in Rails ?
Single Table Inheritance in Rails is a technique used to categorize a base model into multiple sub-classes OR groups without needing to create new tables in the database.
A normal use case would be to have multiple models with almost the same attributes, hence…
Send an email over HTTP calls instead of SMTP delivery method in rails application but the existing code such as
UserMailer.send_reset_password.deliver_now should still work.
We can achieve this by following 3 steps as below:
deliver!method of ActionMailer.
And you are done !!! Now you will be able to send emails using your custom-defined delivery method.
Also, you don’t need to change your existing code as the above setup adds a provision to keep the existing
ActionMailer behaviour along with the custom logic to execute.
Any suggestions on above are much appreciated. Share it if you like it.
Before moving onto Rails & Docker setup let’s quickly understand what exact problem does docker really solve.
So we already have VMs which pretty much fulfils the purpose of setting up a separate machine with its own config. Hence docker didn’t solve the isolation problem, as that was solved by…
Recently in one of my React projects, I stumbled upon a weird error where the variable expected to be printed was actually printed as
undefined. Ehhh… this doesn’t sound new right !!!
Let me explain you with an example:
This works perfectly fine and gives…