Ruby on Rails 3 Tutorial

Michael Hartl

Mentioned 7

Provides instructions for creating dynamic Web applications using Ruby on Rails, covering such topics as TDD, Model-View-Controller, REST architecture, and GitHub.

More on

Mentioned in questions and answers.

Sorry for asking this question but i searched all java realted question but i got more confused. I am still not clear what should i start with

1)My main is build website in Java because someone told me that there are some machine learning or AI libraries available in java which i can use in java. so i decided to use that as it can reduce my work.

Now i don't know java at all some people say following are used to build websites like

1)Servelts alone can build webiste
2)JSP alone can also build webiste
4)Spring with Hibernate
6)Java EE also for webistes

Now guys i am confused where should i start from. Where does core JAVA fits in here.

i was thinking of perhaps learning python as i know i have to learn Python only not its variations

SO please guide me one thing which can solve my basic purpose of using ready made libraries of AI

If i can do that with JSP then i will start with that. But i need to learn all of them then its better if can start learning python.

I have 5 months to finish webiste.

I really don't know why there are many braches of java for doing one thing

If your trying to build a website from scratch, with no prior knowledge, your best bet is to go with Frameworks that provide a complete stack for web development.
If you aren't dead set on java, you could probably start learning ruby on rails, which would be easier to start with (if so, go buy ruby on rails tutorial which goes through all the necessary things for modern web development, from mvc to version control).

For java try :

These two are full web frameworks, that is they handle database, MVC (presentation layer), configuration setting etc... (I'll explain shortly). And could even ease your deployment process.

If you're going to go through any other route (using several frameworks together), you are probably not going to finish what you are doing in five months.
To understand why, and to clear some things you wrote in your question, you need to understand that modern web development (and enterprise development as a whole) is comprised of several different technologies:

  • Presentation: the term web frameworks has been more or less taken to mean frameworks that deal with this side of web development, I.E. how to create a web page (an HTML page). Most of the frameworks offer an MVC like approach (which you can read about elsewhere), and this is what most of the frameworks/technologies you gave sit in- JSP and Struts (which uses jsp) are examples of web frameworks. Servlets is a lower level API that standardizes how to answer HTTP requests (which JSP and struts sit on top of).

  • Persistence: being able to show a webpage doesn't mean squat these days if you can't save data to a database, and that is what the persistence frameworks do (they ease the way you can save data to the database). Hibernate is a persistance framework.

  • For java there are also Dependency Injection, which is what Spring DI is. It's tough to explain DI to people not familiar with the troubles of java, so I won't try to explain it, but it's a very important part of modern java development.

  • apart from these core technologies, there are also many items that you'll need to learn to actually deploy the app (unless your using services like Heroku or Google App Engine, which should simplify things), and troubleshoot it later (understanding how concurrency and HTTP works).

To address the other technologies you brought up:

  • I've never really touched SEAM, so I'm not sure, but it looks like a collection of other frameworks (Mainly EJB3, which itself is a collection of APIs, and JSF).
  • Spring denotes a popular open source group (the SpringSource group) that provides various technologies, but most likely when you hear about it they refer to two things Spring's dependency injection (DI) and Spring's MVC (which is a web framework).
  • JavaEE is merely a collection of high level APIs which other technologies implement (Hibernate implements JPA which is part of JavaEE for instance).

Could someone be kind enough to point me to a comprehensive manual (preferably a book) that would give me basic, step-by-step instructions to setting up and using ruby in a windows environment?

I'm a complete noob at Ruby, gems and Rails. Is it possible for me to get all-inclusive ground-up instructions on how to make web apps with Ruby in Windows?

So far I've read that rubyInstaller and Bash are a good way to use ruby in Windows; so inclusion of these tools would be a much appreciated bonus!

My biggest difficulty so far is simply getting bash set up so I can install gems and start coding apps against them (again I'm a complete noob!)

Also, what text editor/IDE for windows would be best for me to code in?

I would love an A-Z guide to installing Ruby/gems and making a Ruby-on-Rails app.

Thanks all!

Well, personally I would suggest you to develop Ruby on Rails applications on a Mac or Linux machine. But if you really want it on Windows, there's a one-click installer for Ruby.

After installing it, you can install gems through the command prompt that comes with the installation. If however, you want a quick start with Ruby on Rails, I suggest you try out rails installer.

There are a lot of good beginner books for Ruby:

Learn to Program

  • A very nice and well-written tutorial on programming with Ruby. This book is for those who want a refresher on programming and want a nice introduction to the basic features of Ruby.

Programming with Ruby

  • Also called the PickAxe book, this book provides a complete guide and reference for Ruby.

And for Rails:

Ruby on Rails 3 Tutorial

  • A perfect step by step tutorial and intro to test-driven development (TDD) using Ruby on Rails. It also covers useful tools such as GIT (version control system) and deployment using Heroku.

Agile Web Development with Rails

  • This book guides you through a Rails project and examines Ruby on Rails in depth.

As for the text editor, I wouldn't recommend heavy or expensive IDE's, especially when you're just starting out. I would suggest you try out notepad++ which is free and lightweight, or you can try sublime text 2, which has a free evaluation copy, it's a very nice editor and looks like TextMate for Mac.

I have an iPhone app out that stores data on the device. I want to create an app with user accounts like Instagram, Path, Foursquare, Gowalla, etc.

Thus, I think I will need to create an iPhone client app, a MYSQL database, and PHP/Ruby on Rails to connect the two, along with the RestKit Framework for Objective-C.

Are there any good books you guys would recommended for the backend stuff? I am comfortable with the iOS part, but have no history with the backend/webserver side.

For learning PHP (I'm assuming you're new to PHP?) I recommend PHP Solutions by David Powers. For Ruby on Rails, check out Ruby on Rails 3 Tutorial by Michael Hartl.

Im taking on an upcoming project that involved creating and managine a large complex mysql database using RoR. It involved, many table, deep foreign keys, many to many, etc.

Anyone know a good resource (book, website, etc.) which can help me learn how to do it? I need a clearer understanding of migrations and how rails handles relational databases.

Any suggestions?

You can check out books at the Pragmatic Programmers website. Probably one of the best options is: Agile Web Development with Rails

I also found Ruby on Rails Tutorial to be a good resource.

Also be sure to look at the Rails Guides They are well written and cover many topics in depth. For example, the migrations you mentioned and many to many associations You can even download them for offline use. Here is an answer about how to do that here

I am new to ruby on rails and i'm following "Ruby on Rails Tutorial: Learn Rails by Example" from Michael Hartl in the 2nd online edition.

When i run a bundle install from my rails app it shows error like this

Gem::RemoteFetcher::FetchError: too many connection resets (
An error occured while installing rubyzip (0.9.7), and Bundler cannot continue.
Make sure that `gem install rubyzip -v '0.9.7'` succeeds before bundling.

I'm trying these from yesterday night but no result some people say its my internet problem but internet is working fine.

I have been using Compass for a bit now, and just recently changed the environment on my mac to begin the Ruby on Rails 3 Tutorial. After installing Ruby 1.9.3, and re-updating my Ruby Gems, I installed Compass once again. Now whenever I try to do any command with compass (create, watch, etc) it gives me the same error:

You must compile individual stylesheets from the project directory.

I'm completely clueless. Thanks so much for any pointers.

Edit: After further exploration, it seems it isn't reading any Compass commands. I can literally try

compass whateverdude

and receive the same error.

Any ideas?

I leaned ruby, but the syntax and the file structure in rails is very difficult for me to understand, there are many things that I need to follow their "rules" to do, for example, I need to generate the db using the migration... It is not suggested to do with typically typing SQL cmd, it makes me very difficult to move on... Any suggestion on how to learn the whole file and how the structure works? Thank you.

For a newbie, best way to learn Rails is to follow a book fro start to the end, and implement each of the examples in the book. I would recommend you following books:

Ruby on Rails 3 Tutorial-Learn Rails by Example

Agile Web Development with Rails

I find these two books excellent resources. Make sure you follow these books really well, one book at a time.

Following a book is much better practice than learning in bits-and-pieces from web.