Can someone help me get started with ruby on rails? I searched a lot of tutorials on how to get it started but most are out dated and all doesn't seems to work. Getting really frustrated on where to begin. I hope someone here can help me. I just want to learn rails and how it works.
You might want to try the guides on guides.rubyonrails.org (particularly the "getting started" one)
Fred
Honestly you're going to need a book. Tutorials aren't going to go in depth enough for you to understand how rails really works. I read a couple at safaribooksonline.com and was pretty unimpressed but the best beginning rails book I've read was Agile Development Wtih Rails. The current version works with rails 2.2 and they have a page with updates for 2.3. The authors walk you through creating an online store and then they go in depth with ActiveRecord and even touch on deployment. Long after I read the book I still keep the sample code around for reference. Check it out at http://www.pragprog.com
Do you have Ruby experience?
If not I'd recommend doing some basic Ruby before looking into Rails, you'll learn Rails much faster if you understand the basics of Ruby first.
Check out Why's Poignant guide to ruby: http://www.google.co.uk/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fpoignantguide.net%2Fruby%2Fwhys-poignant-guide-to-ruby.pdf&ei=ovE9SsDgFYzc-Qbn7IDMDA&usg=AFQjCNHGuP07rpvY6BbrAdwWN7RMcGmTJw&sig2=1pQ-Ybcr4ZahTeym14j-Pg
It's really clearly explained, it's a hilarious read and it's free.
For a great Rails book:
Gavin
Two books:
Agile Web Development with rails and Programming Ruby by The Pragmatic Programmers.
Visit their site here: http://www.pragprog.com/
Those are the best book to get started Ruby and Ruby On Rails.
Gavin Morrice wrote:
Do you have Ruby experience?
If not I'd recommend doing some basic Ruby before looking into Rails, you'll learn Rails much faster if you understand the basics of Ruby first.
Absolutely!
Check out Why's Poignant guide to ruby:
[long URL snipped]
Direct URL is http://www.poignantguide.net .
It's really clearly explained, it's a hilarious read and it's free.
It's a fun read, but I did not find it that useful for learning Ruby. Programming Ruby (free along with a lot of other stuff at http://www.ruby-doc.org ) and Chris Pine's Try Ruby are probably a bit more useful for absolute beginners.
For a great Rails book: http://www.amazon.com/gp/product/0321445619?ie=UTF8&tag=thinksplayg-20&linkCode=as2&camp=1789&creative=390957&creativeASIN=0321445619
Gavin
Best,
I agree that books are the best way to go,
The two books that together have been and continue to be unbelievably useful:
"Ruby for Rails" by David A. Black the holy grail of rails books, "The Rails Way" by Obie Fernandez
-Gabe
All you really need to get started is to get your first scaffold created.
As already mentioned the ruby on rails guides are absolutely excellent. Congrats to those who wrote them by the way.
If you follow through the getting started guide
Once you have your first scaffolded resource, you are good to go. Tweak it and try different things:
You can decide where to start tweaking. The most visible place to start is to adjust the views to checkout your ability to create good html. Make sure you have a reasonable understanding of html and css etc.
Then go into applying some changes into the model and controller to effect some differences. You might like to set up pagination etc.
Once you have done some tweaking, you can then go on and create your own scaffolded resource.
One of the things that took a while before the penny dropped, was using the api. Initially these look a bit heavy, and not very appealing. Initially it seems like you may never find your way around. But you will soon get a feel for the key classes that contain the main stuff you need.
The other things that took a while to twig, were - identify the difference between Ruby and Rails. Ruby is very object oriented and as such is very extensible. Rails therefore is made up of Ruby classes, and you will be using a combination of basic Ruby methods along with those provided by Rails. Often I would find something in an example in a forum or tutorial, but couldn't find it documented. This was because I was looking in the rails api when I should have been looking in the Ruby api and vice versa. - some of the methods you are using may also be in gems or plugins so you may need to look at the specific gem or plugin docs too. All this seems obvious when stated, but was hard when I started.
You will find lots of discussions about the "Right" way to to do things particularly in the area of keeping your business logic in the model and not polluting the controller with lots of code. Another area that gets lots of debate is the Restful routing.
My advice about these things is to be aware of them, but don't get too hung up on them in the early stages. Just get on and make things work. When I started I put loads of code into the controller because I hadn't worked out how to build it into the model. It soon becomes apparent thought that this is not the best way to do things and when you start to move that code into the model it is extremely satisfying. Later you will find code that you put into the model that maybe didn't belong there and you can find other places to put it.
The great thing about Ruby and Rails though is that it is a very forgiving language. If something works - it works and that is great. As you get more experienced you will look back and see better ways of doing things. For a period, I started to find when I added functionality to my early code, I actually ended up with less code than I started with even with the enhancement included.
For me, the this forum itself has been and continues to be an extremely valuable resource. There is virtually no question that you might have that wont have been answered here already. Since the search is a google style search in the forum, it is usually easy to find what you are looking for. What I do is just type my whole question such as "how do I ......." into the search and very often get the answer I want.
Reading books is great, and I come from a prehistoric era where computer time was so limited that you took the manuals home and read them cover to cover, but that day really has passed. The amount of information needed means you cannot just read it all. The way to go is to do it and then delve into things you need or don't understand. The web has really changed things. I have helped two people get started with rails, and just doing it is the best way, so start with a book that will help you do that. Having said that, I do have a selection of the books mentioned and they are indeed worthwhile. You just have to decide which you need to get started.
hth Tonypm