I only have a background knowledge of java and C, and a bit of unix (learned from the first year Comp Sci) and i do know bit about HTML/CSS... anyways so i've started using the book and the book said that we don't need to know html or ruby or css and that book would be kinda teaching all that as we go along..
And i'm at the part where we create a cart for the online store website, but i find that they just add a ton of html/css of ruby codes without really talking about it, and moving on.. I heard that this book was the best of there for ruby, i just focus on the stuff they mention, but i was wondering if i'm supposed to actually just look at other stuff when they add the CSS or HTML tags or ruby codes... i feel that this book is flying, without much explanation..
Should i just keep going with the book, or go back and study every line of all those codes they just put in the program?
I used this book in my first job and failed miserably. It was my first time and and didn't knew Ruby but was asked by my team leader to just go by this book. And I miserably failed to do anything other than the said methods in the book.
I suggest if you want to t have good grasp at web development, you need to know HTML, CSS and Javascript at a very decent level. After thatstudy Ruby. Then you can go through this book.
Now there was once an article online by a prominent fellow in the rails community saying something worse about this book. But since it isn't online anymore I assume that the blogger realised he was wrong and the book is indeed good. So just go about and find it for yourself. But as I said go through all the other necessary topics I mentioned before you jump into rails.
I've used the this book, is good but as you said they some things lack explanation. Usually the best thing you can do is pretty much use google or stackoverflow to lookup this things that you just don't understand. I was pretty much like you, 0 HTML or Rails, but after 2 weeks of reading code and looking for explanations on the web I can now pretty much understand all of the code, and afterwards everything is pretty straightforward.
My best recomendation is that you modify all of the code they give you, this will force you too lookup everything you don't understand. The good thing is that the code on the book is pretty good, and they try to teach you good programming practices on the way so stick to the book.
The HTML/CSS should be easy to pick up, but if you're having trouble following the Ruby code, I'd suggest you start with a Ruby off-Rails book. The Pickaxe book comes to mind. You can find the 1st edition online. Also the Ruby Way helped me to "get" the Ruby way of doing things.
I would continue with the book, it really is good. However, you might want to look at some other books as well including (but not limited to) Simply Rails 2 and Learning Rails.
I found the Pragmatic book to be a good start and the other two to complement it rather well. After that, just have some fun digging into some of the internals.
I would study the code thoroughly. I think you'll find that (if you keep working at it) ROR is pretty amazing.
I think your best bet will be to keep going at a steady pace on the book - going into more detail if you get lost, and if necessary grab a snapshot from online to keep pace if you break things.
From there I would start branching out into many of the other excellent resources available. Pragmatic Programmers have a book called Advanced Rails Recipes that I hear is also fairly good.
Since Rails is still moving rather quickly your best bet will likely be, once you have a handle on things, to start following some of the latest news. Ruby Alltop might be a good place to start looking for more resources. I would suggest going through as many Railscasts as you can - they are pretty much the definitive place to pickup Rails concepts quickly.
I would highly recommend supplementing the books with screencasts. Ryan Bates in particular has done an enormous amount of Rails screencasts at Railscasts, which are freely available. He has also done some paid screencasts for the Pragmatic Programmers site which are much more in-depth, and very helpful.
Creating multi-model forms was a bit of an early sticking point for me, and Ryan's Pragmatic Screencast series on forms was very helpful. I would also recommend the ActiveRecord series.
I started Rails when it was 1.3. I followed the second edition of Agile web development with Rails. I was facing hard time finding how the things were happening. As I did not have any experience of web development this was more painful. I followed the book and created the depot application twice but I still did not get very much from this book.
I was having trouble understanding the Ruby code mainly. As said by "listrophy" on #rubyonrails
Using rails without knowing ruby is
like trying to write a menu at a
chinese restaurant with only an
english-chinese dictionary.
You should get yourself up and running with Ruby first only then you should dig into Rails. I highly recommend you the Ruby for Rails book by David Black but for Ruby only. Read part 2 and part 3 only from this book. The things about Rails in this book is crap IMNSHO. When you are done with Ruby from this book, carry on your journey with the Agile rails book.
When you are done with all this, you can check out The Rails Way, The Ruby Way, Pro ActiveRecord books.... The list goes on and on... :)
The depot application in the Agile book is a great example of a sample Rails application. However I suggest you to check out Open Source Rails for some more sample apps. Rails Guides also have some very good tutorials on rails. As said by everyone else Railscasts by Ryan Bates has some very high quality free rails screencasts.
FYI I have a little knowledge about HTML and very little about CSS. You can not learn these technologies by following some book. You will learn these with the experience and time. Although some books can give you a good start. But I do recommend you to learn Javascript-Ajax and stuff. For this purpose you should use libraries like Prototype or Jquery. I recommend Jquery as this is much more easier to learn and also more powerful.
HTH :)
Related
I have been making websites in PHP and MySQL for almost ten years now but I have never used a framework. This means I have hand coded everything and I know how the code all works and interacts with itself.
Wanting to expand my horizons I have picked up Ruby on Rails to learn another web language, framework, DB etc. I have been following the Ruby on Rails tutorial and it is going smoothly so far but what bugs me how much of a black box it feels. there's too much magic, and stuff happens just because it does. Example of this "magic" include, if I add to the routes file "resources :users" all of a sudden I have near infinite possible links like /new /user/1 /user/1/edit etc. Or if I want to add a column to my db table I have to do something like this in the console "rails integrate _to_table value:type" and then I have to "rake" the db.
I have been able to make stuff following the tutorial but I don't understand what I am doing. I know part of it will come through experience but I want to know how and why Rails is doing what it does.
What are some good resources, online and books, where I can learn how RoR works?
Yes, it takes a while to know what all the magic is, but you'll get there eventually if you stick with it.
The 'bible' for ruby on rails development is http://pragprog.com/book/rails4/agile-web-development-with-rails
The 'bible' for the ruby language itself is the 'pickaxe' book, with contributions from the ruby language author himself. http://www.amazon.com/Ruby-Programming-Language-David-Flanagan/dp/0596516177
Ryan Bates has done HUNDREDS of free sceencasts and he is famous for having a really great approach, using the framework effectively. Every good rubiest rate these highly. http://railscasts.com/
Many folks find the "zombies" courses really good. http://railsforzombies.org/
Finally I'll offer my own bookmarks site with over 50 sites for rails:
http://www.rormd.com/linker/groups/1
and 20+ sites for ruby at
http://www.rormd.com/linker/groups/4
While you are learning a good IDE can help a lot. I used eclipse, then netbeans then rubyMine (from our friend at IntelliJ, well known for their java editor. rubyMine has the most features. It is not free but for the price (somewhere in the $24-$75 range, depending on special offers) it's well worth the cost.
This is for newcomers if they wants to learn ruby on rails, even don't know Ruby. I can say try this first and jump on others book.
Just hit on below link and see there are two tutorials available for Ruby on Rails 3.0 and 3.2
Ruby on Rails Tutorials link for Rails 3.0 and 3.2
for those tutorials you do not required Ruby backgrounds
even I like Head First Rails, this book is also good for understand - just rails (no TDB), so initial you can set in rails environment and after that jump on above tutorial link
You can see the entire code on Github http://github.com/rails/rails.
The Jose Valim Book Crafting rails application help to understand a lot of internal in rails too
I would say that using the terms "black-box" and "magic" is a quite inadequate and maybe even a bit depreciative. I believe that the difference you are feeling comes from the fact that Ruby is a very different language than PHP, and that it is easier to code high-level abstractions and conventions in Ruby that in PHP. Rails is full of these abstractions and conventions, and these may be quite confusing, specially if you have no ideia of how they internaly work.
Maybe it's not about Rails that you should be reading. I'd say that you should try to understand Ruby in the first place. A good understanding of its blocks, its object model, and its mixins is mandatory in order make that "black-box" feeling go away.
Programming in a modern programming language ain't black magic. Debugging Fortran code by printing the code and using crystals over the papersheets to find the bugs was.
I have been doing desktop applications since I have started programming, and I have not really looked at the web side of things. Seeing how fast this market is growing, I convinced myself that I should learn a web framework. I learned some PHP, and I found it to be quick, but, after projects get beyond small, it becomes a hassle.
So, looking at recommendations online, I took up Ruby on Rails. Now, when I go through the ruby on rails guide, I don't really feel like I'm understanding anything, or really writing any code. I just feel like I'm editing configuration files. Is this normal? Should I just keep going through the guide, and it will all come to me later?
FYI, I'm using this as a tutorial.
When I coded in PHP, I immediately understood what the code was doing, but, with Rails, I really don't understand how all of it comes together.
EDIT: I am good at Python and C, and not bad at Java, if that changes your answer.
Before you start on Rails, I would start with the pick axe book (Programming Ruby
by Dave Thomas http://www.pragprog.com/titles/ruby3/programming-ruby-1-9) since you have previous programming exprience and make sure you have a solid grounding in Ruby.
Then I would go through the Ruby Koans and do some of the ruby quiz's. Both are fun and great practice.
Then I would start with either Michael Hartl's http://ruby.railstutorial.org/ruby-on-rails-tutorial-book or Agile Web Development with Rails (http://pragprog.com/titles/rails4/agile-web-development-with-rails) make sure you are getting the latest edition.
I would suggest Michael Hartl's tutorial first. Don't worry if you feel led by the nose a bit. I found Agile Web Development with Rails, as with a lot of the PragProg books, to expect me to go out and do a lot of research on my own along the way, like in the guides, because the topic is so big.
Then, if you don't know Javascript, you are going to want get a solid grounding in that as well. The Crockford book is highly recommended, but i found that I had to go through something basic first before I could understand a lot of the points that Crockford was making.
Just remember, despite the fact that everybody talks about how powerful/beautiful Ruby is (it is!) and how wonderful rails is (it is!), normal developers aren't going to tell you that it is easy to learn, at least, not the ones that understand the complexity and depth of both. With both you have to work pretty hard to understand them. With Rails, it takes a while to remember all the conventions.
Maybe you should try other tutorial, for example this one http://ruby.railstutorial.org/ruby-on-rails-tutorial-book
In this tutorial, author shows how to build a real app, IMO this is the best way to learn a new technology, by practice.
It's not normal - it's nice!
With Ruby on Rails we stick to a convention over configuration principle.
You should understand rails conventions. With that principle you can get a working site in 15 minutes without any configuration or coding based on best practices.
If you need something special you can code it by your own.
Small advice: buy a book. It is worth it.
I would strongly recommend this online tutorial - "Rails for zombies" -> http://railsforzombies.org/
I have walked through this tutorial and I know two other friends that have started with Ruby on Rails using this site. It is really fun and easy to begin coding.
I have been programming for a while and for the past 3 or 4 months have been learning ruby. I am not an expert by any means but I believe I have the basics down.
I decided to start learning RoR and bought the "Agile Web Development with Rails 3rd Edition" and have been dutifully going through the chapters one by one. Currently I am in chapter 8 and have had no problems so far.
My question is I know I have learned several things so far and I know that I am starting to get a sense of the Rails framework I have this fear that I am just not learning as much as I should. Some things I get and understand the interconnections while I feel on other things I am just going through the motions and don't fully comprehend the total interconnectivity. Now, there is still a large amount of the book for me to complete. I guess I am just wondering if I complete this book what should I expect to be able to accomplish on my own and what should be my next steps.
Thanks
if you complete that book, and fully comprehend everything, you'll have a ton of the rails framework behind you. the only way to master it, is by doing it. write apps, even if they're nonsensical. i wrong a full website alongside the depot app when i went through the first sections of that book. then i tried to find a way to tie-in every part of ActiveSupport covered, then ActiveRecord, etc.
After reading the same book, I was able to build a web application. The building of that web application helped me make all of the connections and learn all of the things that weren't covered in the book. There's absolutely no substitute for putting what you are learning into practice. It's the difference between learning German from a book and waking up in Munich with hangover and no money and making your way home.
Build something.
In addition to the (good) answers already given, I'd suggest sitting down and reading through at least strategic sections of the Rails codebase. The effort of trying to figure out the overall structure of Rails as a piece of software will cement a lot of the connections in your head. On top of that you're likely to learn some new things about Ruby. Might also be well worth your time to read through some good open source apps done in Rails to see how people approach various problems.
Also go through the excellent Ruby on Rails RailsCasts by Ryan Bates.
As I always say to people who's learning something new or improving their knowledgements: "No pain, no gain".
Get through the Agile Web Development book (I'd recommend you the 4th edition though as it deals with Rails 3). Also, take a look at this tutorial: http://guides.rubyonrails.org/getting_started.html, watch some http://railscasts.com/ for best practices, play around with the rails console (rails c in the project directory) and just make your own application!
Think about something cool you'd like to achieve, even if you still have no idea how it should be done. You will get some decent basic knowledges in no time! Personally, I started programming on Rails 3 weeks ago and today I already have done a complete manager with ldap user authentication, ssh connections, XML parsing and YAML writing, stuff I wouldn't imagine I'd be able to do in so little time...
I would like to share with you this blogpost there is a lot of information about to learn Ruby and Ruby on Rails you will love it http://blog.crowdint.com/2013/12/06/the-path-of-the-padawan.html#!
Background
I am interested in getting to grips with some Ruby On Rails. I've got 4 years experience programming in C#, ASP.Net, ASP.Net MVC, SQL Server and more recently Silverlight etc. Obviously I've got a pretty good understanding about the various implementation routes that you can go down when writing web applications using C#, the issue is that I have literally no clue about Ruby On Rails, other than that Ruby is an awesome pure object oriented language and that Rails is a very quick way in which to build web applications using Ruby.
What I'm After
So essentially I'm after a session that fills in the blanks, and helps me to understand the various ways of building web applications using ROR. On top of this, i've found a few tutorials but they seem to be quite vague, so any documentation/samples would be very handy to help get me started.
More Detail
Popular IDE'S to use for development (I've heard RubyMine is good from JetBrains).
Possible database implementations to use (I know MySQL is an option but which version?)
Is HTML/CSS used to style the web apps?!
Interface plugins if used?
General route to producing a highly Web 2.0 site that encompasses a fantastic user experience and a beautiful interactive interface.
...You get the idea, I just need a bit of guidance getting clued up.
Help greatly appreciated :-D
I'd highly recommend starting by reading:
Programming Ruby (also available online)
Agile Web Development with Rails
You should start with the first one, but don't read it all the way through. Once you get the basics of Ruby down, you can switch to the Rails book, but feel free to switch back and forth as you get more familiar with both Ruby and Rails.
The books are both very well written, and they're actually fun to read as far as technical books go. They do a great job of explaining the basics to a total newbie and also really digging in deep. You'll have all of your initial questions answered within a few hours.
When I tried to get into Rails, I bought this Rails for .NET Developers. It was quite useful to get going. After that, the most value I found was watching railscast videos.
For an IDE, I use Netbeans.
Different people learn different ways, but one thing I find to be very helpful for getting a real "feel" for Ruby on Rails is screencasts. The Rails site has a whole section devoted to screencasts. For example, with the 15-minute-blog video, you can actually watch someone work on the blog app and see all the steps along the way. It's not necessarily more informative than, say, a book, but it can be easier to grasp when you're actually seeing it.
The official Rails Guides are kept well up to date -- begin with the Getting Started guide, Railscasts provide quick how-tos on lots of common tasks, and the Agile Web Development with Rails (3rd Edition) book is excellent if you want to sit down and read how it all works.
There's also tons of sample code on GitHub, where you'll find just about all the plugins available as well as lots of well-designed Rails apps that will show you all the best practices.
Regarding specifics you asked about:
Many Rails developers don't bother with an IDE (they just use text editors such as TextMate on the Mac). MySQL is popular for production but for local development, Rails is set up to use SQLite, which is quick and easy. Many developers are moving to a NoSQL datastore such as MongoDb because development is quicker without schemas and migrations. You'll use HTML and CSS but you may use Haml to abstract your HTML templating. For an interactive "Web 2.0" site (as you ask) you'll want to be become familiar with jQuery and CoffeeScript.
You asked the question back in October 2009 but I'm sure other people will continue to want suggestions for the best way to get started with Rails. I hope you've already become a Rails ninja!
i started ruby on rails a few days ago using http://ruby.railstutorial.org/ruby-on-rails-tutorial-book by Michael Hartl. so far so good.
This is my experience, I'm at the stage where I can build simple apps. I am comfortable with code, at least to go to the right sources.
Hartl Tutorial ... go through this at a steady pace, just to understand the overall basics. No way you can absorb everything there.
Why's poignant guide is great to understand how to read code through a story, making things enjoyable and memorable.
Agile guide to rails. This put eveything together, I went through the exercises but stopped near the end. I read what I thought I needed to know how to build something my work would use.
Using railscasts to supplement my app building.
I would recommend as resouces to use apis, irc #rubyonrails, and stack overflow. You would be surprised how people contribute and help you through problems you encounter.
Re: IDE
Most Rails developers use VIM. Or at least the better ones use VIM.
It's more powerful than an IDE. I know and use at least 5 languages and VIM works well for all. I use YADR. If you were with a team, sometimes using VIM or Emacs or Geanie are your best options.
Re: Books
You should read a Ruby book before anything. And by read, I mean, try the examples.
The best book I've read on Ruby on Rails is probably Ryan Biggs' book.
Engineering Long-lasting software would be a good book focused on teaching you some Ruby fundamentals for practical reasons.
I'm a PHP developer who knows a little bit of Ruby. I want to learn Ruby on Rails, but most of the resources I've come across treat RoR functionality as "magic" -- i.e., it has a certain internal consistency, but don't bother asking how it works in terms of Ruby, MySQL, etc.
Anyway, I want a deep understanding of how RoR works, the design decisions that went into building it, etc. In particular I'm interested in ActiveRecord, but really I'm looking for the whole package.
Any books / sites / advice welcome.
The books "Agile Web Development with Rails" and "The Rails Way" are both pretty good. "Pro Active Record" goes really in depth for Active Record, but doesn't touch on too much else. The podcast Railscasts sometimes just uses the magic, but sometimes it explains what is really going on. Various blogs such as Art of Mission can get into what your looking for.
Additionally, using the ruby-debug gem gives you a much better understanding of what is going on - you can step into what is running behind the scenes.
There are two areas here that can be examined separately:
General concepts (which include design patterns, general attitude principles like DRY and CoC or even agility etc.) since they are the principles behind many design decisions in Rails. Any of these concepts can be studied independently of Rails (since they are general programming concepts). It's good to have at least some understanding of these before digging any deeper. There are many sources about such general principles all over the net (aforementioned Martin Fowler's site is one of the better sources for grasping such concepts).
The way Rails implements these concepts into its corpus. There are, again, two things to have in mind here. Since Rails heavily exploits features of its mother language, it's crucial to understand Ruby's peculiarities (such as mixins and plenty of Ruby's dynamic features). The last thing to understand is how Rails uses these features, ie. how it's broken down into classes and modules, how many of its features are dynamically created on the run and so on. For this purpose, I highly recommend book Ruby for Rails from David A. Black (which is exactly about Ruby, its peculiarities and the way Rails uses them). While this book might be a bit out of date, I think it's still invaluable in its content.
If you really want to know how it works, you can just look at the source code. The online API docs let you see the source code of every method right in the documentation page.
ActiveRecord in Rails is based on Martin Fowler's Active Record pattern. It's basically an ORM (object-relational mapper). It's not even really that sophisticated as far as ORMs go. Java Persistence with Hibernate has a good overview of common ORM concepts.
This one might fit here well too -> http://railsforphp.com/
This is sort of a tangential answer to your question, but I, too, came from PHP development over to Ruby/Rails dev, and it was a big transition for me. As PHP devs, we're used to getting into the nitty-gritty, to to speak, and not being prevented from looking under the hood.
By design, Rails is a black box. You're supposed to learn Rails, almost as a language itself. It's a new way of thinking of web dev, especially from a PHP dev's perspective, though this idea is not uncommon to programming in general.
Not bothering to look under the hood may be the best way to start doing things "the Rails way."
Jamis Buck has a nice series of "Under the Hood" articles on his blog that cover some aspects of Rails' internals.
The "magic" in Rails involves method_missing and the concept of metaprogramming. Dave Thomas of The Pragmatic Programmers created a set of screencasts on metaprogramming Ruby.
PHP has a somewhat-equivalent function called __call, and PHP 5.3 introduced __callstatic. You might take a look at those, as well as search Google for "php metaprogramming", for some reading material on implementing Rails-like behavior in PHP.
I found this site a good starting reference:
http://www.tutorialspoint.com/ruby-on-rails-2.1/index.htm
It assumes MySQL in its examples.
I am sure you can find heaps and heaps by just googling for "ruby on rails tutorials", though.
ruby metaprogramming magic in rails: look at books by Rappin "Professional Rails" and Ediger "Advanced Rails", in addition to Black "Ruby for Rails" mentioned above
Naming conventions are important:
http://rails.wincent.com/wiki/Rails_conventions
http://www.softiesonrails.com/2007/10/18/ruby-101-naming-conventions
If you really want to understand Rails, read the source for the bit of Rails that you want.
/Library/Ruby/Gems/1.8/gems/ on OSX or freeze rails and have access to it in your RAILS_ROOT/vendor/ directory