Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Rails and windows 7 issues

Hi!

 1. As I'm on Windows 7, there is not such a thing called rvm. what should I do for start? (Generate a Rails Application)

 2. When I type « rails server » in treebook folder via Command Prompt, after showing the next line, nothing happens! I've waited for about a half an hour ... also I've PC Installed on my PC. is that the issue?

[Time-Time]INFO    WEBrick::HTTPServer#start: pid=1668 port=3000

 3. The 0.0.0.0:3000 address doesn't open

 4. by going to 127.0.0.1:3000/statuses there is an errror:

ActiveRecord::StatementInvalid in StatusesController#index
Could not find table 'statuses'
Rails.root: C:/Sites/treebook
Application Trace | Framework Trace | Full Trace
app/controllers/statuses_controller.rb:5:in `index'
Request
Parameters:
None
Show session dump
Show env dump
Response
Headers:
None

I got the same error , and am using windows , would you guide me on how to fix this ?

It was more than one problem and it took me more time.

Right now I stopped learning ruby and I'm doing some PHP projects to get some money. After that I'm buying a Mac...

10 Answers

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

@Mohammed Thanks for the heads-up! On windows, you can use ctrl+pause/break to stop the server. I've updated the notes on the video with that information.

I don't know about anyone else but ctrl + c works for me and I have windows 7

2 : explanation : Ctrl-C doesn't work!

4 : Problem solved... for content I used textarea instead of text

Where did you use textarea instead of text??

In the first step of the video

Thanks for the clarification Mohammad. The Teachers are going to check this out for you really soon.

Both the rvm and 0.0.0.0 only apply if you are working on a OS X or Linux.

On windows the way to start rails is to type rails s webbrick will then tell you the address it's starting on. By default you can access the rails web server webbrick on 127.0.0.1:3000.

If you close your command prompt, kill the process or use CTRL-C you will stop the webbrick server.


You can check out these pages for instructions on how to correctly install & generate your first rails app on Windows.

http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby-windows

closing it won't be logical! maybe for a big project have to do it for some reason 100 times a day! :D no way! and in that link it said : type ctrl-c which didn't worked.

but I found it... in windows it can be done by Ctrl + Break button. then it asks :

Terminate batch job (Y/N) ?

and you say : y :D

All of the Questions got solved. ;-)

thanks for help dear @James


p.s: but for running the server, I open another command prompt of Rails and hide it with Watch Cat so in Alt+Tab s It doesn't bother me! ;)

This won't solve the issue in Windows 7, but often developers working on Windows machines will install and run Linux in a VM for RoR development.

Phillip Steiner walks through this process on his blog: http://www.psteiner.com/2012/04/rails-3-on-windows-ubuntu-on-virtualbox.html

I've always considered it a best practice from a system admin perspective to always develop in a VM.

Whether you are developing on OS X, Linux or Windows virtualbox runs on all of them.

Then you can have one VM for every project, no cross contamination if you are developing against different versions, you can match the production toolchains exactly.

Turnkey Linux VMs make experimenting with new CMSes & frameworks dead simple.

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

It looks like you may need to migrate your database for this to work. Try stopping the server with ctrl+break and typing the following:

rake db:migrate

@rhys : thanks for the link ;)

@James : I'll consider using Ubuntu on VM for Developing

@Jason : still ctrl-c doesn't work!