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”