Exploring Object-Relational Mapping in Ruby

As for homework this week, I was given the task to create a Sinatra app with each Object-relational mapping (ORM) we learned in class: Sequel, ActiveRecord and DataMapper. I built these simple applications that gave a name, age, color and description to rabbits. Link to the repository here.

In this blog post, I am going to talk about my experience using all three ORMs and state my favorite one.
Continue reading “Exploring Object-Relational Mapping in Ruby”

Use Them, Blockhead! – Learning to Use Ruby Blocks

Blocks are sort of mystical to me. I know very little about the magic that happens under their hood. To aid this lack of knowledge, I decided to write a blog post on blocks hoping that by writing about them I will acquire some knowhow.

As I understand it, blocks are pieces of code that are wrapped by either curly brackets

 array.each{ |element| #some logic here# }

or between a “do” and “end” example:


array.each do |element|
#some logic here#
end

Inside either the curly bracket and the do-end boundaries of the block you write what you want your block to do. So far so good.
Continue reading “Use Them, Blockhead! – Learning to Use Ruby Blocks”

Recursive Dancing

Friday night, class was over and we, the students, were celebrating the end of a successful week by playing games and dancing. I was dancing to my heart’s content when I looked at the white board. It had the following code:


def fibo_finder(num)
  if num < 2
      num
  else
    fibo_finder(num-1) + fibo_finder(num-2)
  end
end

It was the solution a ruby problem we had earlier in that day. It required us to find the nth number of the fibonacci sequence.
Continue reading “Recursive Dancing”

Troubleshooting Heroku Deployment Errors

I was at my wit’s end. For one hour or two, it indeed felt longer, I was trying to deploy a Sinatra web application that I created this past week week at the Flatiron school to Heroku. Something was definitely amiss because Heroku kept telling me:

! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to ...

I tried to remove and add the heroku repo again and again to no avail. I tried to close terminal and restart it but nothing. What did I do to you, Herokuuuuu???? I felt like weeping, anime-style.
Continue reading “Troubleshooting Heroku Deployment Errors”

What Cecily Carver told me when I was learning how to code

Our tutors at the Flatiron School asked us to read one of Cecily Carver’s article and ponder about its message.

It is a great article. The bulk of touches on the message that it is with practice that you master coding and that there will always be someone who thinks you are an amateur. I believe in these as well. I am aware of both the 10,000 hours rule and of the fact that haters will always be haters.
Continue reading “What Cecily Carver told me when I was learning how to code”