A few weeks ago, I encountered a problem, which I think, really really weird!
How weird was that?
So, I have some tables with one to many relationship, let’s say table
articles has many
images has many
image_sizes (the tables are different with the actual case). The system has a job that executes codes fetching
Article load it eagerly with
ImageSize. We thought it was safe, since there were no complicated process at all. Just load at print it!
After a while, booooom! We had 500 in production……. Continue reading “My Experience with
These past days have taken me to a place that I need to learn more about executing a raw query, without relying on generated active record object (existing model classes).
Last week, I wrote a lib, that I think, required me to wrote it with custom or raw query. My research was filled with these kind of results
I used it actually. But, until I find it hard to produce a query string that free from SQL injection. Anyone knows how to do it? Continue reading “Raw Insert Query with ActiveRecord”
This afternoon, I had a chance to discuss about something with my pair about the difference between comparison operators and control flow operators in Ruby. Yes! What is the actual difference between && || operators and “and” “or” operators?
I started Ruby around 4 years ago and I wrote a code like this
if (a == true and b == true)
# my code
And I swear I won’t do that again! Continue reading “Understanding Ruby Comparison and Control Flow Operators”
This afternoon, I was asked by my friend about how to make email column allow redundant data with rails and devise. Honestly, I never did something like that before and I couldn’t imagine what kind of case he was trying to solve with that particular design.
What I advised him was try removing the unique index attached to email column. That’s actually an easy task, just generate a migration file and make a little change so the migration file will be like this
class RemoveEmailIndexOnUser < ActiveRecord::Migration
remove_index :users, :email
Migrate it and boom! The index is now gone. In case, you still need the index, but don’t want it to be unique, you might have this code after the
add_index :users, :email
Continue reading “Redundant Emails with Devise”
Hi Coders and Hello 2015!
Happy new year to all! Yeah, I know it’s already January 12, but it’s not to late to say that, since we’re still in January. :D
Guys, I have a new hobby now! (Oh please! Don’t you have anything else to tell people?)
Yes! Wandering around exploring github to find some awesome and cool project. One thing that I found interesting is peek. It’s like a bar that shows some helpful information related to your application performance. Queries performance is one of them. Continue reading “Addition for peek-mysql2”
There was a time when I wondered, which one has better performance, NodeJS, Ruby, or PHP? And I decided to make a little test. I didn’t think this test would conclude overall performance, but specifically for this context, I would know which one was the best. The test were divided into 3 phases, they were: preparation, result, and conclusion. I hope my little research here will help you in your development. And for your information, this test is using NodeJS (0.8.9), Ruby (2.0.0p0), and PHP (5.4.17). Continue reading “Plain Text Reading and Processing with NodeJS, Ruby, and PHP”
It’s very exciting for me to announce that my very first book is out! Actually, I’m not the only author in this book, there are Giovanni Nugraha and Nia Mutiara whom I collaborate with to produce this great book. This book is about using devise in your rails application. It will helps the reader to start with devise, apply some customizations, add privileges, make remote authentication, and tests. So why wait? Go to the book website and make an order!
Continue reading “Learning Devise for Rails is Out Now!”