Slashdot Mirror


Rolling With Ruby On Rails

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."

5 of 406 comments (clear)

  1. Useful Ruby Online Resources (categorized) by Anonymous Coward · · Score: 5, Informative

    A categorized collection of ruby links can be found here in a nicer format:

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

    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

  2. Ruby still needs ISP support by Anonymous Coward · · Score: 5, Interesting
    The biggest drawback to RubyOnRails is that you wont find it installed on very many webhosts.

    I given it a testdrive, and RubyOnRails is an amazingly fast and powerful way to develop webapps, but even so, it's been around for a while and still 99% of webhosts only stick to tomcat & PHP/MySQL, so that's what I code for. Even Python w/o Rails has more ISP support.

    My question is: When will RubyOnRails get "popular enough" to make inroads? I'm looking forward to it, because it means I can be way more productive and get a head start on all the other PHP "solution providers" out there.

  3. Have you ever programmed a web app before? by Paradox · · Score: 5, Informative
    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 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.

    --
    Slashdot. It's Not For Common Sense
  4. FlexGrid? by ackthpt · · Score: 5, Funny
    Ruby doesn't have FlexGrid ocx which basically makes it useless for database apps.

    FlexGrid? FLEXGRID?!?!

    Implementation of FlexGrids is responsible for extreme stress, male pattern baldness, genital warts, dry heaves, infertility, webbed toes, seeing spots, loss of super powers, carpal tunnel syndrome, diarrhea, dandruff, dispepsia, gas, fingernail rot, yellowy wax buildup, stink foot, Plantars warts, incontinence, communism, crusty boogers, arthritis, bursitis and and cooties. The only treatment is 500mg of Dammitol, fiftytwo times a day.

    You, sir, are a maniac.

    --

    A feeling of having made the same mistake before: Deja Foobar
  5. Re:Played with it by Merk · · Score: 5, Informative

    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.