Hi all I took a look to several examples of RoR on different web sites, and I found that it is hard to write a class, in RoR, because I do not understand all the codes used on the source code. jsn -- Posted via http://www.ruby-forum.com/.
Hi all I took a look to several examples of RoR on different web sites, and I found that it is hard to write RoR code, in RoR, because I do not understand all the codes used on the source code. jsn -- Posted via http://www.ruby-forum.com/.
On Jul 28, 2006, at 10:55 PM, Jose Pepe wrote:> Hi all > > I took a look to several examples of RoR on different web sites, and I > found that it is hard to write RoR code, in RoR, because I do not > understand all the codes used on the source code. > > jsnI felt the same way, until I swallowed my pride and bought the book. Well, actually, I started by learning some Ruby (www.rubyquiz.org is nice for this). Another thing I did was to write all my shell scripts in ruby. Between Dir#[] and the backtick (`) operator, I now find shell scripts much easier to write in Ruby than I ever did in bash. And it was good practice. But the rails stuff didn''t really start to click until I started reading the Agile Web Development with Rails book. It''s really worth the ~$30 even if you''re just playing around with Rails. I have yet to find what I would call a really _good_ beginner book online. -Mat
Mat Schaffer wrote:> On Jul 28, 2006, at 10:55 PM, Jose Pepe wrote: > >> Hi all >> >> I took a look to several examples of RoR on different web sites, and I >> found that it is hard to write RoR code, in RoR, because I do not >> understand all the codes used on the source code. >> >> jsn > > I felt the same way, until I swallowed my pride and bought the book.I bought and read AWDWR and could not fully understand it because my Ruby skills were nil. I''ve read the Manning book and am now feeling that I understand what is happening and why better than ever. Manning does a good job explaining the Ruby philosophy. Going back to the AWDWR book is now easy reading and I can focus on the overall concepts and program structure it teaches rather than trying to get bits and pieces of Ruby which it was not meant to teach. AWDWR does a good explaining the Rails philosophy which builds on Ruby with its framework and included Ruby classes and methods. I''ve also got Rails Recipes and the Pickaxe. Recipes are good because you can just use them. Eventually I''ll read the Pickaxe to make my Ruby top notch. I would recommend to newbies (as I still am to Ruby and OOP) to read the following books in this order: 1. Manning''s Ruby for Rails 2. AWDWR 3. Recipes, if you just want to get things done. Bill -- Posted via http://www.ruby-forum.com/.
Hi -- On Fri, 28 Jul 2006, Mat Schaffer wrote:> > On Jul 28, 2006, at 10:55 PM, Jose Pepe wrote: > >> Hi all >> >> I took a look to several examples of RoR on different web sites, and I >> found that it is hard to write RoR code, in RoR, because I do not >> understand all the codes used on the source code. >> >> jsn > > I felt the same way, until I swallowed my pride and bought the book. Well, > actually, I started by learning some Ruby (www.rubyquiz.org is nice for > this). Another thing I did was to write all my shell scripts in ruby. > Between Dir#[] and the backtick (`) operator, I now find shell scripts much > easier to write in Ruby than I ever did in bash. And it was good practice. > > But the rails stuff didn''t really start to click until I started reading the > Agile Web Development with Rails book. It''s really worth the ~$30 even if > you''re just playing around with Rails. I have yet to find what I would call > a really _good_ beginner book online.There''s also my book "Ruby for Rails: Ruby techniques for Rails developers" which is a Rails-centered Ruby tutorial book. R4R includes sections about the Rails source code, as well as lots of Ruby techniques and explanations with a Rails spin. (See link in sig.) David -- http://www.rubypowerandlight.com => Ruby/Rails training & consultancy ----> SEE SPECIAL DEAL FOR RUBY/RAILS USERS GROUPS! <----- http://dablog.rubypal.com => D[avid ]A[. ]B[lack''s][ Web]log http://www.manning.com/black => book, Ruby for Rails http://www.rubycentral.org => Ruby Central, Inc.
I highly suggest the books that the others have mentioned, but if you are not ready to spend any money yet you can get started with the old version of Programming Ruby which is free online at http://www.rubycentral.com/book/index.html I got started there and it really helped me to get a handle on how ruby works before I was willing to take the plunge and buy a bunch of books on RoR. Read the chapter on classes (http://www.rubycentral.com/book/tut_classes.html) and that should give you an idea of how to write a class. Most rails classes look strange because they inherit from ActiveRecord::Base or ApplicationController so there is a lot going on in those parent classes that you don''t see, but you can look at the documentation at http://rubyonrails.org/api/ to see what''s going on. I hope this helps, Jake On 7/28/06, Jose Pepe <jsnit@jsnit.com> wrote:> Hi all > > I took a look to several examples of RoR on different web sites, and I > found that it is hard to write a class, in RoR, because I do not > understand all the codes used on the source code. > > jsn > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
I''m brand new myself to Ruby and Rails and even programming. I started with AWDWR and ran into problems about understanding the code. I got David''s book Ruby for Rails (Manning) and have been going through that for the last week. I''m kind of curious to know if the book should be sufficient enough to get me going in using Rails ? A few things I noticed, and correct me if I''m wrong, but it seems a Rails web app would not be as "complex" as a Ruby program. Maybe this has something to do with the framework itself and Active Record, etc. On the other hand I think if your having to learn Ruby and Rails you now have another layer of complexity, terms and techniques to soak in. Another thing the I''m curious about and I realize everyone''s evolution is different but it seems that many of the Rails gurus have a pretty good background / experience(years) in Ruby alone. At the same time I imagine that people are coming to Ruby and Rails specifically because they want to learn and use Rails. I''m just wondering if that is really practical. Stuart On 7/29/06, Jake Jacobsen <jake@jakejacobsen.com> wrote:> I highly suggest the books that the others have mentioned, but if you > are not ready to spend any money yet you can get started with the old > version of Programming Ruby which is free online at > http://www.rubycentral.com/book/index.html > > I got started there and it really helped me to get a handle on how > ruby works before I was willing to take the plunge and buy a bunch of > books on RoR. > > Read the chapter on classes > (http://www.rubycentral.com/book/tut_classes.html) and that should > give you an idea of how to write a class. Most rails classes look > strange because they inherit from ActiveRecord::Base or > ApplicationController so there is a lot going on in those parent > classes that you don''t see, but you can look at the documentation at > http://rubyonrails.org/api/ to see what''s going on. > > I hope this helps, > Jake > > On 7/28/06, Jose Pepe <jsnit@jsnit.com> wrote: > > Hi all > > > > I took a look to several examples of RoR on different web sites, and I > > found that it is hard to write a class, in RoR, because I do not > > understand all the codes used on the source code. > > > > jsn > > > > -- > > Posted via http://www.ruby-forum.com/. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Stuart Fellowes wrote:> Another thing the I''m curious about and I realize everyone''s evolution > is different but it seems that many of the Rails gurus have a pretty > good background / experience(years) in Ruby alone. At the same time I > imagine that people are coming to Ruby and Rails specifically because > they want to learn and use Rails. I''m just wondering if that is really > practical.Stuart, your mileage may vary but I did not know Ruby when I discovered RoR 3 months ago. I knew Ruby was a language invented in Japan and used to do OO scripting. I thought it was "like Python only more obscure." I never read a line of it before. I did not even do a demo application or create the examples in the book. I just watched the screencasts, skimmed the books and started re-writing portions of a large PHP app, learning as I went along. I am about a couple weeks away from production now. This is possible if you have a good background in several different programming languages and web frameworks. The superiority of RoR is clear if you have been around and approach it with an open mind. Some additional time may be required to absorb new concepts if you are new to MVC (model/view/controller pattern), RoR''s philosophies (DRY, REST, TDD, etc.), or if you are accustomed to a single vendor environment. Do not let the new language intimidate you. Ruby is very simple to get started and it reads very well. Definitely get the Pickaxe book as a Ruby tutorial and reference. The PDF version will come in handy. I use the reference in the appendix about every 10 minutes when I''m coding. Between that and the api.rubyonrails.com, you should have everything you need to get started. As you go along, you will discover the language has all kinds of neat features. Personally, I like that so much is unfamiliar. It keeps things fresh and interesting. Steven -- Posted via http://www.ruby-forum.com/.
While the advice all of you have given is quite good I think it''s missing the point a little. Let me explain: It''s obviously trivial to literally write a class for rails class Foo < ActiveRecord::Base end What''s not trivial is understanding how this class, which is completely devoid of content, can possibly have so many variables and methods you can interact with. Which even inheritence doesn''t explain well. How can you possibly inherit a variable from a piece of code written long before yours that somehow magically has the name of the variables in your database. The problem here, I suspect, is that the original poster doesn''t understand the magic that is Ruby''s ability to alter classes at runtime or the trickery of the method_missing method. But, the thing is, you don''t NEED to understand that at all in order to use Rails. You just have to accept that code magic happens and that there will be a variable for every column in the corresponding table in the database and there will be all your standard CRUD methods for affecting the object itself. Yes, these magical insertions at runtime make it harder to know what exactly is available for you to call but you''ll gradually understand it as you go. Just keep a browser window open with http://api.rubyonrails.org open. I realize programmers like to have everything spelled out for them in their code but sometimes it''s best to just have faith that things will work out while you work towards enlightenment. -kate = masukomi -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060730/558a0432/attachment.html