Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror
×
Programming Technology

Rolling With Ruby On Rails 406

Bart Braem writes "The Ruby community is abuzz about Rails, a web application framework that makes database-backed apps dead simple. What's the fuss? Is it worth the hype? Curt Hibbs shows off Rails at ONLamp, building a simple application that even non-Rubyists can follow."
This discussion has been archived. No new comments can be posted.

Rolling With Ruby On Rails

Comments Filter:
  • Played with it (Score:5, Informative)

    by tenchiken ( 22661 ) on Friday January 21, 2005 @01:16PM (#11433216)
    And did a quick application with Ruby on Rails already. If you are confortable with Perl, you may find this easier to deal with then Python and it's love of whitespace. The object model is much more developed then either python or perl, but it still retains much of the flexability of the other two systems.

    Ruby has already inspired a few efforts to duplicate the technology in Java and in .NET. Since the core technology behind RoR is open classes, and the ability to add accessors and functionality on the fly, the other languages just don't cut it.

    The usual warnings apply. Implicit code is easier 90% of the time, but that other 10% is painful to debug. With large projects you can prototype fast, but maintaining may be much more difficult.
  • by Anonymous Coward on Friday January 21, 2005 @01:19PM (#11433259)
    A categorized collection of ruby links can be found here in a nicer format:

    http://www.rubygarden.org/ruby?RubyOnTheNet [rubygarden.org]

    Interactive ruby resources:

    irc://irc.freenode.net/ruby-lang - the #ruby-lang channel is popular. More info at RubyOnIRC

    http://www.ruby-forum.org/bb/ - a forum for ruby novices to ask questions

    news://comp.lang.ruby - the ruby newsgroup

    Ruby websites:

    http://www.ruby-lang.org/ - ruby home

    http://www.ruby-doc.org/ - ruby docs and online reference

    http://www.rubyforge.org/ - rubyforge ruby projects

    http://raa.ruby-lang.org/ - ruby application archive

    Ruby Code Examples and Snippets:

    http://pleac.sourceforge.net/pleac_ruby/ - ruby pleac

    http://www.rubygarden.org/ruby?RubyOnlineCookboo k - ruby cookbook

    Popular ruby and ruby-related projects:

    http://rubyinstaller.rubyforge.org/wiki/wiki.pl - ruby installer for Windows

    http://rubyforge.org/projects/rubygems/ - rubygems ruby package manager

    http://www.yaml.org/ - ruby 1.8 includes built-in yaml support

    http://www.rubyonrails.com/ - web framework in ruby

    http://rubyforge.org/projects/instiki/ - wiki in ruby
  • by Aredridel ( 93503 ) on Friday January 21, 2005 @01:27PM (#11433340) Homepage
    http://theinternetco.net/offers/ruby

    Ready, installed, and waiting.
  • by JackRuby43 ( 588879 ) on Friday January 21, 2005 @01:32PM (#11433385)
    so does Modwest (a great host and supporter of Open Source)

    http://www.modwest.com/ [modwest.com]
  • by Minam ( 456447 ) on Friday January 21, 2005 @01:34PM (#11433401) Homepage

    You might want to tell that to Basecamp [basecamphq.com], 43 Things [43things.com], and Tada Lists [tadalist.com], since they obviously have no idea that Rails isn't good for anything of that magnitude. Might also mention it to all the thousands of people that use those sites, daily, and to the handful of developers who built and deployed those sites in a fraction of the time and cost of other web solutions.

    Then again, maybe you shouldn't...

  • by Paradox ( 13555 ) on Friday January 21, 2005 @01:34PM (#11433409) Homepage Journal
    Rails is an incredibly good framework for Ruby, that really shows off its power and makes it easy to get a web application going, but it's not all that Ruby has to offer.

    Ruby is full of incredible libraries and frameworks like this, especially where text processing and web development are concerned. It's because Ruby has such a rich set of features.

    Anyone who likes Rails should dig deeper. Heck, Ruby's standard library comes with some amazing things. Ruby also has a framework called RubyGems [rubyforge.org],
    which is very much like Perl's CPAN integration or CommonLisp's ASDF framework.
  • by Paradox ( 13555 ) on Friday January 21, 2005 @01:43PM (#11433510) Homepage Journal
    Well, most of the article is setup. But I do agree the article is less than a stunning demo of rails. Instead, you might want to fire up the video at www.rubyonrails.com [nextangle.com] which walks you through a 10 minute application build.

    It's extremely cool to watch someone set up a working webapp that fast.

    But I have to take issue with:

    Take a look at this example. It's incrediblyl complicated and all it does is display a horrible little form that lets you query cookbook recipies!
    Half of the darn article is setting up MySql and installing Ruby and Rails from scratch on a windows machine. Do you have any idea how much harder this crap is to write in other frameworks? You'd have to write at least 2x as much code. No one has an Active Record class as good as Rails'. You'd double the code count just doing the SQL linkage!

    It's one thing to be unimpressed, but it's another to know jack shit about the domain and say it's all worthless. Anyone who's ever made a web application will appreciate it.

  • And, if you get hosting at TextDrive, they'll give half of your money to supporting RubyonRails development!
  • by Anonymous Coward on Friday January 21, 2005 @01:46PM (#11433547)
    Ruby is a relatively new programming language from Japan that is rapidly growing in popularity. In Japan it has already overtaken Python in popularity and has started to gain a loyal following in other countries.

    Before year 2000, there were no English-language books about Ruby. Now we have a fast-growing English library including Ruby in a Nutshell, Programming Ruby 2nd Ed., Teach Yourself Ruby in 21 Days, and more.

    The lack of English documentation was what held Ruby back in popularity. With that problem now largely addressed, it has started to gain popularity rather quickly in the USA.

    Ruby was designed by Yukihiro Matsumoto, a.k.a "Matz". It is a pure OO language but has time-saving features which make it useful for one-liners like Perl. If you like being highly productive, having fun programming, and want your code to make sense a year later, then give Ruby a try.

  • Perhaps the documentation for ActiveRecord will help answer your question?

    http://ar.rubyonrails.org/

    You can automatically retrieve data from the database in the form of an object, do manipulations or calculations, display it, modify it, then do a save() method on the object and it'll go right back into the database.
  • by Minam ( 456447 ) on Friday January 21, 2005 @01:50PM (#11433578) Homepage
    Consider Hieraki [hieraki.org], or RForum [andreas-s.net], or any of the other projects listed at the bottom of The Ruby-on-Rails docs page [rubyonrails.com].
  • Re:Nice framework... (Score:3, Informative)

    by DevNull Ogre ( 256715 ) on Friday January 21, 2005 @01:54PM (#11433609)
    The "ten times" claim is about development time, not run time. You didn't take it a step further, you took an orthogonal leap.
  • by dash2 ( 155223 ) <davidhughjones.gmail@com> on Friday January 21, 2005 @01:58PM (#11433661) Homepage Journal
    or indeed Maypole [perl.org]?
  • by Paradox ( 13555 ) on Friday January 21, 2005 @02:00PM (#11433674) Homepage Journal
    Firstly, Rails's ActiveRecord class is very simple Ruby code, so it's naturally bug-resistant.

    Secondly, the author knows that ActiveRecord could be a source of problems, which is why it's got dozens of unit tests, covering nearly every line of code.

    Thirdly, even with all that bugs can and will sneak through, which is why ActiveRecord can, upon command, write a detailed log of its attempt to dynamically bind and create the classes you want. The logging is at the message-passing level of Ruby, which is nearly as atomic as you can get (you could hack the interpreter to go further, but that'd be pointless).

    The dark ages of hideous bugs in dynamic code are gone my friend. We have the tools and techniques to make code of this type both safe and maintainable. Don't be afraid of it.
  • by JimRay ( 6620 ) <jimray@gma[ ]com ['il.' in gap]> on Friday January 21, 2005 @02:09PM (#11433777) Homepage
    You might try TextDrive [textdrive.com]

    Fantastic tech support, lots of support for opensource projects, a full ruby on rails implementation. These cats kick ass.

    Lurk on the forums [textdrive.com] for a day or so to get a feel for things, it's not a bad place to call ~/
  • by Webster132 ( 241537 ) on Friday January 21, 2005 @02:19PM (#11433899)
    Ruby on Rails is growing at an astounding rate right now, which is not at least due to the growing number of real-life applications that has been build upon it. Including:

    Basecamp [basecamphq.com] -- The original Rails application from which the framework was extracted. A hosted project management application that combines weblog, todo lists, milestones, file storage, and more to keep everyone on the same page in a project.

    43 Things [43things.com] -- The "What do you want to do with your life?" application that lets you enter the 43 things that you're currently looking to achieve in life. You can blog about doing it, find others doing the same, and give advice to people who are doing things you've done.

    Ta-da List [tadalist.com] -- The todo list component of Basecamp factored out into a free mini application. Uses XMLHttpRequest and other JS techniques to keep the interface super snappy. Sharable todo lists for every occasion.

    And those are just a small sample of all the public applications out there on Rails. On top of that, there's a wide range of e-commerce, content management, business intelligence, intranet systems, and more being build inside a lot of organizations.

    Exciting times!
  • by poboxbot ( 784307 ) on Friday January 21, 2005 @02:23PM (#11433935)
    True and true.

    There's one host that looks promising: http://www.textdrive.com/ [textdrive.com] -- It's run by Dean Allen (wrote TextPattern), David Heinemeier Hansson (wrote Rails), Matt Mullenweg (wrote WordPress), among others.

    Not astroturfing -- I co-lo elsewhere, and almost wish I was willing to do the virtual host thing again to try it out.
  • by badboy_tw2002 ( 524611 ) on Friday January 21, 2005 @02:23PM (#11433939)
    I saw that, and the philosophy of giving half their income back to the project is _awesome_. What a way to fund an OSS project, and especially cool in this case because they can convert people (like me) with websites for small clubs or groups that would like to try Rails but don't have an ISP that can do it. One question about all this though, how long has the company been around? Are they kind of fly by night? I could see a real nightmere if they collapsed and you were left swinging without any place to run your webapp.
  • Re:Played with it (Score:5, Informative)

    by Merk ( 25521 ) on Friday January 21, 2005 @02:24PM (#11433953) Homepage

    Once you get used to the idea of passing blocks of code around, you'll love it, and won't be able to go back to Python... er... I mean, won't be able to go without it.

    The canonical example is the iterator. Given an array pets containing ["dog", "cat", "fish"]:

    pets.each { |pet| puts pet }

    Will return
    dog
    cat
    fish
    If you want to print out the uppercase versions

    pets.each { |pet| puts pet.upcase }

    Or if you want to add some text:

    pets.each { |pet| puts "I love my pet #{pet}" }

    Big deal, right? Not much different from a for loop. But blocks are amazing when dealing with things like a database. You can put all the setup, teardown and error-handling code in a method that's hidden from the user, and all they have to do is pass in the block they want the DB object to execute:

    require 'dbi'

    DBI.connect('DBI:Mysql:test', 'testuser', 'testpwd') do | dbh |

    puts "inserting..."
    sql = "insert into simple01 (SongName, SongLength_s) VALUES (?, ?)"
    dbh.prepare(sql) do | sth |
    1.upto(13) { |i| sth.execute("Song #{i}", "#{i*10}") }
    end

    puts "selecting..."
    dbh.select_all('select * from simple01') do | row |
    p row
    end

    puts "deleting..."
    dbh.do('delete from simple01 where internal_id > 10')

    end

    Unfortunately, slashdot eats my indentation, but fortunately, Ruby not being as picky about whitespace as *some languages*, that doesn't matter. Note that all that code is wrapped in a DBI.connect() call, which connects before it starts executing the block, and disconnects after. There's no "close" call required, it's all wrapped up for you.

  • Development time (Score:2, Informative)

    by cardmagic ( 224509 ) on Friday January 21, 2005 @02:51PM (#11434299) Homepage

    I originally built Web Collaborator [webcollaborator.com] in 8,000 lines of PHP over a couple of months. In about 16 hours, I had completely rebuilt it from scratch in the Ruby on Rails framework with 1,000 lines of code.

    I have since created sites like The Conjuring Cabaret [rufy.com] and S5 Presents [s5presents.com], both with astonishing simplicity and rapid development. Rails gives me short-cuts for almost everything I ever want to do with web development.

  • Nope. (Score:3, Informative)

    by Paradox ( 13555 ) on Friday January 21, 2005 @03:47PM (#11434919) Homepage Journal
    Not necessary.

    Besides, Ruby doesn't have real continuations. Their continuations are based of longjmp() C call, so it has some limitations that real continuations don't have.
  • Re:Offtopic - Ruby (Score:3, Informative)

    by Paradox ( 13555 ) on Friday January 21, 2005 @04:10PM (#11435200) Homepage Journal
    Ruby has an amazing community, almost everything you could want is online.

    Check out www.rubycentral.org, which has an online ruby book (for 1.6, but it's a place to start). It will take you to all the other sites.

    I highly recommend getting in on the mailing list, ruby-talk. It's very interesting.
  • by drew ( 2081 ) on Friday January 21, 2005 @04:51PM (#11435677) Homepage
    i've tried rails a little bit, and jsp before that, and wasn't particularly impressed with either. is there a reason all web frameworks require a weird directory structure? rails seems better then jsp because it doesn't require an arcane descriptor file, but it still requires you to use a funky directory structure, which means the structure of your application doesn't seem to correspond in any meaningful way with your web site structure.

    why can't someone build a decent framework that follows the simple "directories are directories and files are pages" model used by asp, php, cgi, etc.

    and what's with the database naming conventions? the author kind of brushes it off at the end with this statement: "Even if you have to use a legacy database that does not use the Rails naming conventions, you don't have to give up the productivity advantages of using Rails--there is still a way to tell Rails explicitly what table and column names to use." personally I would not use those conventions no matter what database i was using, nor would any decent database developer or administrator i have ever known.

    at any rate, at work i program in whatever language they tell me- currently asp+jscript, before that php. for personal projects, my current favorite is perl's HTML::Mason. all the benefits of php (and then some) without the awful language conventions.
  • Re:Offtopic - Ruby (Score:2, Informative)

    by objo ( 746181 ) on Friday January 21, 2005 @04:57PM (#11435747)
    Dave Thomas' Programming Ruby book - aka "The PickAxe" is all you will need. He just released the second version of the book and it will be enough to do anything you want. rubyforge.net is also a great are for projects.
  • In Rails, the model is responsible for getting/putting data from/to the database and creating objects used by the controller.

    The controller is responsible for manipulating the objects from the model.

    The view is used to display controller data and to send user data back to the controller.

    It works very well.
  • Re:Offtopic - Ruby (Score:1, Informative)

    by Anonymous Coward on Friday January 21, 2005 @05:34PM (#11436138)

    Wheres a good tutorial site? (multipule if possible)

    why's (poignant) guide to Ruby [poignantguide.net]
    A very cartoonish introduction to Ruby and programming in general. This one hides complexity of the language at first, but goes into more detail later. It uses interesting analogies and stories to keep the whole thing interesting. Has been praised all over the place.
    Programing Ruby, The Pragmatic Programmer's Guide annotated version [phrogz.net]
    The first edition of the definite Ruby programmer's in-detail book. I learned Ruby using this and enjoyed doing so. Make sure to try out lots of code in IRB while you read it. This version has been annotated so you can easily find places where the language changed since the first edition was released. The second edition is better than ever and you will have to pay for it. Many people happily did so, even if they already had a physical copy of the book.
    RubyDoc [ruby-doc.org]
    A short and fast introduction to Ruby. Teaches you how to learn by yourself, using IRB, Ruby's amazing interactive code interpreter.
    Introduction to Ruby [bct-portal.com]
    Another relatively rapid introduction. Not too much to say about it, but it looks straight-forward.
    A little Ruby, a lot of Objects [visibleworkings.com]
    While this is more of an introduction to OOP in the world of very dynamic languages, it uses Ruby to express its samples. Definitely worth a read to see just how easy things like meta programming are done in Ruby.

    Any books worth reading?

    Programming Ruby: The Pragmatic Programmer's Guide, Second Edition [pragmaticprogrammer.com]
    I already hinted at this in the above list. Definitely worth getting, has all the details. You can either buy this from your local evil overlord mega corporation [amazon.com] or directly from the Pragmatic Programmers [pragmaticprogrammer.com] who are also offering a PDF version [pragmaticprogrammer.com] on their site.
    The Ruby Way [amazon.com]
    This goes a long way to explain how to do specific programming tasks in Ruby. It's a slick read and the code sample will usually show insightful ways of using to the language in powerful ways in detail.

    There's more than these, of course, but these will definitely get you started.

    General resources sites?

    Ruby-Doc [ruby-doc.org]
    Collects lots of documentation of Ruby on one single site.
    RedHanded [hobix.com]
    Coming from the same guys who brought you the poignant guide to Ruby this is already guaranteed to be a very interesting read. One of the nicest Ruby weblogs there are right now. Also have a deeper look at his Links sidebar, it contains lots of good stuff.
    Ruby Application Archive [ruby-lang.org]
    Contains lots of interesting Ruby libraries. A nice place to start research. Has been largely superseded by
    RubyForge [rubyforge.org]
    These guys offer free Ruby project hosting. You get everything from a bug tracker to CVS access and automatic gene
  • by andreas1245432 ( 852138 ) on Friday January 21, 2005 @07:32PM (#11437368)
    It doesn't prevent you from mixing static with dynamic content. You can put any kind of static files in the "public" directory, which is the document root for the server. Only when a request cannot be satisfied directly from the document root it is forwarded to Rails (with mod_rewrite); Rails then extracts the information which controller/action is responsible for handling the request from the URL. For example if you request "/forum/list" from the server and there isn't a file with this name in the "public" dir, Rails calls the action "list" in the controller "forum". (The template file for this controller would be in "/app/views/forum/list", but you can easily override the template path, render a template from the database, return plain text, the content from a file or redirect to another page.)

    This also offers some nice possibilities for caching: save the result from the dynamic "/forum/list" request to a file called "/forum/list" in the "public" directory, and the web server won't bother Rails with this request at all, but will deliver the file directly. If the list content is expired, delete and recreate the file. Rails also provides methods to automate this.

    I suggest you just try the tutorial; I'm sure you will find that Rails is extremely flexible and doesn't set any limits to your development style.

  • by draven ( 387 ) on Saturday January 22, 2005 @03:43PM (#11442930) Homepage Journal
    Dude.
    That's just not true. Class::DBI lets you set up your application just as easily as Active Record. Try looking at some Maypole application examples to get a clue.

"Gravitation cannot be held responsible for people falling in love." -- Albert Einstein

Working...