Rails on Windows

Hello,

I’m a bit new in Rails development. Just want some advise if I can just use Windows for Rails development or probably switch to Linux. Been having a hard time setting up Rails on Windows. Thanks in advance.

It’s certainly possible to use Windows for Rails development. Check out http://rubyinstaller.org/ to get you started; it’s probably the easiest way to get Ruby and Rails on a Windows machine.

There are probably advantages to using some flavor of *nix but RubyInstaller should work fine.

1 Like

Yes, I have 2 Ruby’s, one installed using the msi, the other in VirtualBox

Last I knew there were supposedly some differences between Windows and *nix flavors (other than speed).

But I think for learning purposes the Windows flavor would be good enough for starters.

Once you get more advanced though I think it would be wise to go the VM route just to be more sure that what you code locally won’t break moving it to live.

Unless of course you have a *nix available for use now, if you do I wouldn’t bother with Windows and use that straight away.

1 Like

Installing and managing a ruby based workflow on Windows is a painful existence. Therefore, I would highly recommend using a virtual machine with a true linux environment. A VM can be easily set-up using puphpet. In setting up the VM one would merely disregard any packages like PHP and Apache that are unnecessary.

1 Like

Thanks for the inputs, guys. Just another thing, if I would be going into a full time Rails developer, would it be best for me to put in a dedicated machine using Ubuntu than Windows?

Having only Windows I can’t be sure, but from what I understand it would save you from a lot of the aggravation and pain involved with running Ruby on Windows

If you are planning on being serious about it (more than just for learning for now) not based on what I know first-hand but from what I’ve heard from many I’d have to say yes.

1 Like

Got it. Thanks!

Been reading and following tutorials about Rails everyday after work and on rest days however, a lot of time I get faced into a brick wall and overwhelmed about the information or the tutorials. If anyone can just recommend a Roadmap to Learning Rails effectively would be of great help.

I just installed ROR on Win 7.
Get version 2.0.0 otherwise you will have some errors that will stop you in your tracks.

I am using this to get started.

I got to “$ rails new blog” when I got my first error, looked it up and people recommended 2.0.0.
second error was on line 6 of application.html.erb

<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>

I deleted that line and everything went well, I want to fix it but it’s on the back burner.

Make sure you are using the command prompt that comes with Ruby, the regular cmd.exe will not work, spent several hours before I figured that one out.
You will also get some errors, read them carefully and they will mention to make sure you do this or that.

The errors happen @ $ rails new blog, you have to read the error and do what it says, One was json was missing and I forget what the other one was.

Once you get past “new blog” it should be clear sailing, I am up to the form validation section.

Good luck.

Having been on both sides I would say yes some form of *nix would probably be best but not necessary. If you are able to get Ubuntu on a machine then I’d definitely work toward that. For a long time I had a machine that dual booted both Windows and Fedora before I purchased a MacBook Air. It worked well enough for me.

How much programming experience do you have? I ALWAYS recommend that you take some time to learn the basics of programming. This will help demystify some of the “magic” that goes on with Rails. I suggest Learn to Program by Chris Pine and Learn Ruby the Hard Way by Zed Shaw

If you feel confident in your programming abilities, I would jump right to the Rails Tutorial by Michael Hartl or Agile Web Development with Rails 4 by Sam Ruby.

Hope that helps. :thumbsup:

2 Likes

Thanks, will check em out. I’m a bit of adept in HTML/CSS and some Javascript and Wordpress development as well.

In my previous post I mentioned that I put

<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>

On the back burner, turns out that I could not delete a database entry without it.
I googled the error and people wrote that it was a UTF8 issue in,
C:\Ruby200\lib\ruby\gems\2.0.0\gems\execjs-2.5.2\lib\execjs\runtimes.rb
changed that and still had problems.
(People will also mention you need therubyracer, that will not work in windows)
I finally stumbled on an article that said,
app/assets/javascripts/application.js to delete these lines:

//= require turbolinks
//= require_tree .

As you can see those lines are commented out but sure enough deleting them worked.
Here is a link
http://collaborate.je/2014/08/setting-ruby-rails-windows-7-via-cygwin/

Just posting this as a follow up in hope that it helps someone in the future.
(I spent about a day trying things but nothing was working).

Oh yea, one more note, I changed the database to MySQL, in database.yml
Changed to,

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: ruby
  pool: 5
  username: root
  password: poi
#socket: /tmp/mysql.sock
test:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: ruby
  pool: 5
  username: root
  password: poi
  #socket: /tmp/mysql.sock

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: ruby
  pool: 5
  username: root
  password: poi
 # socket: /tmp/mysql.sock

Then add

gem 'mysql2'

to Gemfile

then bundle install.

One last IMPORTANT step, restart the WEBrick server or you will spend hours trying to figure out what you did wrong.

Wow, what a disaster. How much time have you spent just trying to get Rails to run on Windows? In my opinion anything more than an hour is absurd given Vagrant can have anyone up in running in a matter of minutes…

1 Like

I don’t use RailsInstaller. I use a portable mowes setup instead and then add c:\mowes\ruby\bin to the PATH environment variable, It works fine.

So what you’re saying is you don’t end up having to solve issues like this.

Good find! It worked on my old laptop for a year. Basically I copied the files from my old laptop that worked at the time onto my new laptop, and it doesn’t work on my new laptop. I’ll check again if it works on my old laptop.

I’ve fixed it now. It works perfectly.

No actually it’s still not fixed. It works on my old Windows 7 computer but not my newer Windows 8 one.

The never ending nightmare with ruby or node on windows without using a vm.

Take it from me, it’s not always fun on Windows with a VM :weary:
Doable, yes, fun, errrmmm …

Ebay are selling Macbook Air for £200. I should buy one when I get paid because they’re fast and macs don’t have this problem and so I can learn how to make iPhone apps at a later date.