How to Update Your Fork on Github for Windows

I have installed GitHub for Windows and don’t regret it. It saved me remembering every git command, and let me work more easily with repositories.

I am sure,  not many developers will download it, specially Ruby on Rails developers who are used to writing commands and are not fan of development using tools with rich UI.

But for me, I needed something to simplify my git workflow, while working with others on an open source project related to Ruby on Rails facebook group.

One of the main processes developers use on open source projects are forking and updating their forks with the original repository.

Unfortunately this feature is still not available on GitHub for Windows (Nov 13).

I checked with the wonderful support team of GitHub

My question:

Is it true that, in GitHub for Windows, we cannot update our fork with the last commits from the original repository, and we have to do it using the shell manually?

Their answer:

That’s correct. We know how important this is in the ‘fork and submit pull request’ workflow, and as a result this is high on our list of things to implement in GitHub for Windows. Unfortunately I can’t give a firm date for when we’ll release this feature.
Thanks for letting us know you’d like to see this added, and be sure to keep an eye on and the GitHub for Windows release notes for updates.

So for now if you need to update your fork with the latest from the original repository, you will have to run the shell as shown below:

then run the commands:

git remote add upstream

git fetch upstream
git merge upstream/master

Then press the sync button, to sync to your fork on github website.



Detecting User Location with Rails

So building my little web app (An Arabic tool to convert Arabic numbers to their text representation), I needed to detect user’s country to improve the site usability by improving the defaults.

researching, found this to be the simplest way possible. It does not
even require a database. As you will be connecting to third party

– Create an account at

– Once you register, you will get your api key.

– Download geo-ip Ruby Gem (gem has not been updated since March 2012, but it is still working like a charm with even with latest Rails 4)

– Now, all you need to do is to create an initializer file in the folder config/initializers (call it geo-ip):

GeoIp.api_key = ‘YOUR_API_KEY’

– Then you can get the ip of the user by this rails method:

user_ip = request.remote_ip

– From the received ip, you can now get location info of users by calling methods of the geo-ip gem:

country = GeoIp.geolocation(user_ip, :precision => :country)

For all geo ip methods, please the check out the gem documentation

Google Map Marker

Google Map Marker (Photo credit: [ Mooi ])

Cloud66 Deployment Failure When Upgrading to Rails 4

As you may know if you follow my blog. I develop on a Windows machine (and everyone hates me for that).

As I don’t know much about web server, vps, clouds, Capistrano..etc I decided to use to make deployment of code hosted on githib easier.

After upgrading to Rails 4, app worked on my local machine, but not on my production environment (digital ocean ) managed by cloud66

I received errors related to Capistrano and Psych which I know nothing about

/usr/local/lib/ruby/1.9.1/psych.rb:154:in `parse‘: (): couldn’t parse YAML at line 0 column 5 (Psych::SyntaxError)
from /usr/local/lib/ruby/1.9.1/psych.rb:154:in `parse_stream’
from /usr/local/lib/ruby/1.9.1/psych.rb:125:in `parse’
from /usr/local/lib/ruby/1.9.1/psych.rb:112:in `load’

So I have contacted cloud66 team, who advised it is an asset pipeline issue caused by upgrading to Rails 4. And they suggested to delete the manifest cache files (/var/deploy/tafqit-amesterdam/web_head/shared/assets/manifest*).

I logged in to my cloud66 dashboard where I have web console access to my server, I navigated in directories and deleted files as instructed and deployment went fine, now I have my site upgraded to Rails 4! What a joy!.

This was my first time where I had to navigate files on Ubuntu, but found out to be easy, simillar to DOS.

all Ubuntu console commands can be found here

Abandoned mine: view down rails (4 of 6)

Good bye old Rails 3

Upgrading to Rails 4 for these who used RailsInstaller

RailsInstaller still has not updated to Rails 4 in its bundle. But you can do the upgrade yourself.

It worked well for me, follow this screencast and you will be safe.

Deploying Ruby on Rails Applications for Beginners

You always see on Rails forums, rails newbies asking about their best option for hosting their small web app.

In the world of php, deploying is a much simpler process with choices among thousands of good cheap hosts.

When it comes to Rails less options are available, although significantly increasing these days, and process is more complicated.

The biggest issue arises when you are like me a Windows user and developed your app on your Windows machine. Of course, the first thing every other developer may tell you is to move to Linux (Ubuntu is by far the most popular).

Actually moving to Linux for Rails developers may be the right decision which I still have not taken. And this is why I made this blog.

( As you may have already noticed I usually target new rails developers on Windows )

So the most recommended host for beginners, is Heroku, extremely to use and usually it is easy to move your site from your local Windows machine to their servers. The problem with Heroku is their prices. They have a free basic account, but does not offer much, if you get some traffic, soon you will have to upgrade and rate will jump drastically.

After some research I found that my best bet is to use Digital Ocean

Their basic account is for $5 a month, no other Rails host can beat that, trust me.

Now after registering with Digital Ocean, I found it a bit complicated to move my local Rails App to their cloud, so I was introduced to Cloud 66

They say it very clearly: Cloud 66 makes deploying and running of Ruby on Rails apps simple. And it is so true. All you need is your Digital Ocean account, and your app on github. Cloud66 will analyze your code and create the right environment on Digital Ocean.

Have Ruby on Rails Installed on Windows the Best Way

This is a complete step by step instructions with minimal explanations, on how to set up your Windows machine for starting building your RoR application in the most efficient and professional way.

Most of this is inspired from the Michael Hurtl most recommended Rails book 

1. Download and install RailsInsaller

2. Download and install Console 2

3. Download and install Sublime Text 2

4. Download and install Herkou Toolbelt

5. Open Console 2

6. Navigate through cd commands to a folder where you want your app folder to be created

7. Run rails new applicationname (will create the application directory with all rails default sub-directories and files)

8. Open gemfile with Sublime Text 2 and change as per your required gems. I found the gemfile used by Rails tutorial book is perfect to use in every application, then add gems when you need later. But make sure you:
  – remove rb-fsevent, growl, rb-inotify, libontify
  – add 

gem ‘rb-fchange’, ‘0.0.5’
gem ‘rb-notifu’, ‘0.0.4’
gem ‘win32console’, ‘1.3.0’

Google the pages of these gems to check their latest version and change the version number accordingly

9. Navigate with Console 2 to your newly created app folder and run bundle install

10. Run rails s

Congratulations you now have rails server running with some beautiful essential gems.

11. git init

12. git add .

13. git commit -m “Initial commit”

14. Create git account on github

15. git remote add origin

16. git push -u origin master

Congratulations you have just set up Git to work smoothly with your app.

17. Create a heroku account

18. Run heroku login on console 2

19. heroku create

20. git push heroku master

Congratulations you have hosted your app on Heroku.

The most recommended testing environment is rspec, and here is the best way to install it with the best supporting gems and options.

21. In console 2, run rails generate rspec:install

22. bundle exec guard init rspec (guard gem for autotesting)

23. change content of guardfile to the one used in the tutorial

24. bundle exec spork –bootstrap (spork gem for speeding up tests)

25. Change content of spec/spec_helper.rb to the one used in the tutorial

26. Change content of .rspec file to 


27. bundle exec guard init spork (to tell rails to use spork with guard)

28. add :cli => ‘–drb’ argument to guard ‘rspec’ line in guardfile

29. In sublime text 2 go to preference -> Package Control and select install package find  rubytest and have it installed.

30. preference -> Package Settings->RubyTest->Settings – User add bundle exec before any rspec you find

Congratulations you now have rspec testing framewrok installed with the best supporting gems to autotest, notify, and speed things up. You can also now run tests from Sublime Text 2 itself.

In thirty steps you now have everything ready for the best development environment on Windows for any serious application development.Image

How to get help while developing in Ruby on Rails?

Am sure I will need to search online help almost everyday in my first year developing RoR.

Here where am currently posting my questions:

stackoverflow: the best. make sure you tag your questions well. But I will let you know about the amount of responses I get. Am really not sure how is the RoR community on stackoverflow, but I have used for other coding questions, and I found it to have a great deal of experts, and used to get Drupal related answer within 48 hours.

ruby on rails talk on Google Mailing List

I have posted one question there. a few minutes ago. I have no experience using Google Groups. The interface looks like from the 10 year old Internet. Anyway I will be updating you about the Google Group RoR community.

If you are in The States, not my case. You can call the free  Rails Hotline.

There is also Rails Mentors, which relies on rails experts volunteers ready to help beginners.

There is also the Rails Forum , I have not tried it yet.

Working with Rails forum, I have not tried it yet, but does not look to be very active.

Also the reddit rails forum seems to be active

Facebook Groups:

Ruby on Rails: Almost 10,000 members by the time of writing this with excellent administrators, keeping spam at bay!

Ruby on Rails Learning and Fun : Another but much smaller group.

Onscreen Expert  (added Sep 2013)  where you can hire experts who would help you by remoting to your machine. It costs from 0$ per hour (offered by the site founders themselves) to $150. Click here for rails experts.

Will keep the list of support resources updated.

Ruby on Rails, Getting Serious

Many resources are available to learn Ruby on Rails, here are a list of the most popular ones: (Be sure am not affiliated to any resrouce)

1. Learn Rails by Example: This is the book and video tutorials I have decided to use. Highly recommended by many. And at the end you will create a serious web app from start to finish getting exposed to all tools a a real developer would use.

2. Agile Web Development with Rails: from the creator of Rails. In this book you will build a shopping cart with Rails.

3. Rails Best Practices: Many thinks this to be the best online programming course on the web today. I will probably do this one, once I finish with the first (Learn Rails by Example)

4. Rails in Action 3: A highly recommend book too.

So, I am buying the first resource. It is a bundle which contains the book in pdf and screen casts. You can read the book online for free

My next posts in July and August will be mainly all based on me reading the book and watching the video tutorials.

Ruby on Rails 3 Tutorial Book Cover

Finally! Starting with Ruby on Rails!

So I have finished learning basics of Ruby with Try ruby and ruby monk and it was time for Ruby on Rails.

To get a fast good overview of the basics of Ruby on Rails. The very famous beginning for new commers  is definitely the wonderful Code School,  Rails for Zombies. Like all Code School courses, it is fun to work and help you retain what you have learned by doing little code snippets assignments after every chapter!  With this tutorial you build a a small web app similar to Twitter. That was an excellent start for me.

In case you get stuck at an exercises (most are easy and straight forward), just google : rails for zombies lab (Number) exercise (Number) and you will find the answers. Most are in

Please if you fail with one exercise, try more. rewatch the video of the chapter, if you still could not insert the right code, only then google the answer. I needed to google only once.

Zombies from The Beyond

Get Rubied Before Getting Railed

Don’t jump into learning Ruby on Rails. I can’t wait for that too. But I already know that a good Ruby on Rails developer is a good Ruby programmer.

Let’s get Rubied before getting Railed.

I think we will love Ruby