×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Part 2 of Ruby on Rails Tutorial Online

Zonk posted more than 9 years ago | from the productive-coding dept.

Programming 187

An anonymous reader writes "Curt Hibbs has released Part 2 of his tutorial Rolling with Ruby on Rails to the O'Reilly ONLamp site. The first part was published in January. Topics covered are database transactions, callbacks, unit testing and caching." From the article: "In Rolling with Ruby on Rails, I barely scratched the surface of what you can do with Ruby on Rails. I didn't talk about data validation or database transactions, and I did not mention callbacks, unit testing, or caching. There was hardly a mention of the many helpers that Rails includes to make your life easier. I can't really do justice to all of these topics in the space of this article, but I will go into details on some of them and present a brief overview of the rest, with links to more detailed information."

cancel ×
This is a preview of your comment

No Comment Title Entered

Anonymous Coward 1 minute ago

No Comment Entered

187 comments

GNAA Welcomes Martha Home (-1, Troll)

Anonymous Coward | more than 9 years ago | (#11843826)

GNAA Welcomes Martha Home
GNAA Welcomes Martha Home

(Bedford, CT. - DEVELOPING) Chief Eastern Seaboard GNAA Operative Gary Niger today wished a warm, gay welcome home to Marth Stewart, source of some of our favorite recipes!

Without Martha, the twice-yearly GNAA embroidering circle would be a shell of what it is today. Without Martha's timeless advice, the Gaynigger-seed poundcake we presented to Timecop last week would have surely been missing essential plumpness and flavor.

The GNAA thanks Martha for all that she has given to us as gay niggers. When the final hour arrives and women are expunged from the planet, Martha may well be given the second chance the SEC so far has been unwilling to give.


About GNAA:
GNAA (GAY NIGGER ASSOCIATION OF AMERICA) is the first organization which gathers GAY NIGGERS from all over America and abroad for one common goal - being GAY NIGGERS.

Are you GAY [klerck.org] ?
Are you a NIGGER [mugshots.org] ?
Are you a GAY NIGGER [gay-sex-access.com] ?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!
Join GNAA (GAY NIGGER ASSOCIATION OF AMERICA) today, and enjoy all the benefits of being a full-time GNAA member.
GNAA (GAY NIGGER ASSOCIATION OF AMERICA) is the fastest-growing GAY NIGGER community with THOUSANDS of members all over United States of America and the World! You, too, can be a part of GNAA if you join today!

Why not? It's quick and easy - only 3 simple steps!
  • First, you have to obtain a copy of GAYNIGGERS FROM OUTER SPACE THE MOVIE [imdb.com] and watch it. You can download the movie [idge.net] (~130mb) using BitTorrent.
  • Second, you need to succeed in posting a GNAA First Post [wikipedia.org] on slashdot.org [slashdot.org] , a popular "news for trolls" website.
  • Third, you need to join the official GNAA irc channel #GNAA on irc.gnaa.us, and apply for membership.
Talk to one of the ops or any of the other members in the channel to sign up today! Upon submitting your application, you will be required to submit links to your successful First Post, and you will be tested on your knowledge of GAYNIGGERS FROM OUTER SPACE.

If you are having trouble locating #GNAA, the official GAY NIGGER ASSOCIATION OF AMERICA irc channel, you might be on a wrong irc network. The correct network is NiggerNET, and you can connect to irc.gnaa.us as our official server. Follow this link [irc] if you are using an irc client such as mIRC.

If you have mod points and would like to support GNAA, please moderate this post up.

.________________________________________________.
| ______________________________________._a,____ | Press contact:
| _______a_._______a_______aj#0s_____aWY!400.___ | Gary Niger
| __ad#7!!*P____a.d#0a____#!-_#0i___.#!__W#0#___ | gary_niger@gnaa.us [mailto]
| _j#'_.00#,___4#dP_"#,__j#,__0#Wi___*00P!_"#L,_ | GNAA Corporate Headquarters
| _"#ga#9!01___"#01__40,_"4Lj#!_4#g_________"01_ | 143 Rolloffle Avenue
| ________"#,___*@`__-N#____`___-!^_____________ | Tarzana, California 91356
| _________#1__________?________________________ |
| _________j1___________________________________ | All other inquiries:
| ____a,___jk_GAY_NIGGER_ASSOCIATION_OF_AMERICA_ | Enid Al-Punjabi
| ____!4yaa#l___________________________________ | enid_indian@gnaa.us [mailto]
| ______-"!^____________________________________ | GNAA World Headquarters
` _______________________________________________' 160-0023 Japan Tokyo-to Shinjuku-ku Nishi-Shinjuku 3-20-2

Copyright (c) 2003-2004 Gay Nigger Association of America [www.gnaa.us]

Re:GNAA Welcomes Martha Home (-1, Offtopic)

Cryptnotic (154382) | more than 9 years ago | (#11844730)

Second, you need to succeed in posting a GNAA First Post [wikipedia.org] on slashdot.org [slashdot.org], a popular "news for trolls" website.


Every time a bell rings, an angel gets his wings, right?

Congratulations.

Angels and wings (1)

gavri (663286) | more than 9 years ago | (#11845071)

"It's true that every time you hear a bell, an angel gets its wings. But what they don't tell you is that every time you hear a mouse trap snap, an angel gets set on fire." --Jack Handy

fdfdsfds (-1, Troll)

Anonymous Coward | more than 9 years ago | (#11843828)

fdsfsdfBrians!

Python Version of RoR (4, Interesting)

grayrest (468197) | more than 9 years ago | (#11843850)

http://subway.python-hosting.com

It's rough, but it's coming along.

Re:Python Version of RoR (3, Insightful)

jellomizer (103300) | more than 9 years ago | (#11843892)

It is always good to have two closly competing languages. Ruby and Python are so close in design it helps keep both on their toes. Some people consider Python and Perl to be competive but the language syntax is much more different, and often lead to more of a holy war debate on what is better. While I don't find this type of argument for Python vs. Ruby But I could just be looking in the wrong spots.

Re:Python Version of RoR (0, Troll)

KiloByte (825081) | more than 9 years ago | (#11844029)

Python and Perl not only differ in syntax, but also aim at completely different niches.
You're not really supposed to write big programs in Perl -- Perl is better suited for short tasks, anything that includes heavy string parsing and/or sysadmin chores.

[evil Perl zealot hat on] Python, on the other hand, serves as a poor excuse for a "real" language aimed for apps longer than several screenfuls of code -- but, it loses because of [XXXXX]. It's also likely to give you Cobol fingers.

In the above, [XXXXX] stands for the real arguments against Python. They were censored out to keep this post within the Holy Wars traditions -- meaningful arguments are not allowed.

Re:Python Version of RoR (1)

m50d (797211) | more than 9 years ago | (#11844081)

Cobol fingers? If you've ever coded in a team you will be indenting anyway, python just means you can type most of the language using the normal keys, rather than twisting your fingers round to reach the edge of the keyboard at every turn. (Seriously, how do you type all that punctuation? I suppose the extreme conciseness of perl means there's less typing overall which maybe makes up for it, but still....)

Re:Python Version of RoR (4, Insightful)

Colonel Panic (15235) | more than 9 years ago | (#11844239)

Wouldn't that be PoR?

Seriously, though, I really think that Ruby the language is part of what makes RoR so great. I'm not sure you can do a lot of the same stuff in Python as you can with Ruby. Being able to define natural looking domain-specific languages using Ruby's code blocks seems like something that would be very difficult in Python. But as they say, imiation is the sincerest form of flattery...

Re:Python Version of RoR (3, Insightful)

Simon (815) | more than 9 years ago | (#11844603)

Being able to define natural looking domain-specific languages using Ruby's code blocks seems like something that would be very difficult in Python.

Do you any examples of this in action? I mean a non-trivial example showing a Ruby block based solution for a problem that is clearly better than the more tradional (messy?) solution.

Impress me. :-)

--
Simon

Re:Python Version of RoR (1)

Tyler Eaves (344284) | more than 9 years ago | (#11845129)

Haven't done any ruby in a while, so I don't have any code handy, but blocks are great for things like GUI callbacks. You can put the code right where it would logically fit, and you don't end up with a 1001 quitButtonOnClick() type functions cluttering your namespace.

Re:Python Version of RoR (1, Informative)

Anonymous Coward | more than 9 years ago | (#11845631)

[3, 4, 2, 6, 7, 8, 1, 12, 5].sort { |x, y|
if x >= 5 and y >= 5
y x
else
x y
end
}

This sorts the array in the ascending order up to 5, and in the descending order after that, which gives [1, 2, 3, 4, 12, 8, 7, 6, 5]. This is a very simple example, but it would be less nice without blocs. Then you have more interesting cases, like:

[1, 3, 7].collect { |x| x+1 }

Which gives [2, 4, 8]. The result array is built by taking every element of the first array and applying the bloc to it. Not convinced ?

[3, 4, 12, 76, 2].find { |x| x > 4 and x.modulo(2) == 0 }

Gives 12, of course. But by using the same bloc with find_all instead of find, you get [12, 76].

Of course, it's nothing new. You could get an equally nice syntax by using a functional language. But to my mind, ruby brings you the best from OOP and the best front functional programming. I just wish it was faster.

Re:Python Version of RoR (0)

Anonymous Coward | more than 9 years ago | (#11845658)

It seems I should have be more careful. In the first bloc, you should have

"y <=> x" and "x <=> y" instead of "y x" and "x y".

If you think ruby is special, you are mistaken. (-1, Flamebait)

Anonymous Coward | more than 9 years ago | (#11844645)

Just because you like ruby, doesn't mean other languages can't do what it can do. Ruby doesn't have anything that makes it special, everything you can do with ruby can be done in other languages, although not always the same way. You can't claim ruby is "better" because it does things differently, that's entirely just your personal preference.

And quite frankly, some people think that ruby's syntax is nasty and prefer c style languages. "Natural looking" languages aren't helpful to me, I am not speaking to the computer, I am writing a set of logic. As such, I do not want a natural language, I want a logic language. Despite perl's well-earned reputation for being hard to read, I still find it much clearer than either python or ruby.

So try to keep in mind, personal preferences about syntax don't mean one language or another is better or worse. Choice is good.

Re:Python Version of RoR (1, Funny)

Anonymous Coward | more than 9 years ago | (#11844819)

Being able to define natural looking domain-specific languages using Ruby's code blocks seems like something that would be very difficult in Python. But as they say, imiation is the sincerest form of flattery...

Yes, the guys who invented Smalltalk must be really proud that Ruby has finally managed to produce a popular version of all their innovations.

What is this? (4, Insightful)

Lovesquid (840251) | more than 9 years ago | (#11843903)

Hmmm... nowhere in the summary does it tell what "Ruby on Rails" is, or why I should care about it, and with the server getting hammered, I can't RTFA to find out. How about including a 1-sentence summary of what the topic of any story IS before posting it, for those of us who don't already know everything there is to know about everything.

Re:What is this? (1)

JMUChrisF (188300) | more than 9 years ago | (#11843975)

from the rubyon rails web site

Rails is a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups

Re:What is this? (1)

Otter (3800) | more than 9 years ago | (#11843983)

I must have gotten in just ahead of the mob...to quote from Part I:

Ruby on Rails, the super productive new way to develop web applications

OK, that's helpful. Continuing...

Ruby is a pure object-oriented programming language with a super clean syntax that makes programming elegant and fun...

Rails is a open source Ruby framework for developing database-backed web applications. What's special about that? There are dozens of frameworks out there and most of them have been around much longer than Rails. Why should you care about yet another framework?

What would you think if I told you that you could develop a web application at least ten times faster with Rails than you could with a typical Java framework? You can--without making any sacrifices in the quality of your application! How is this possible?

Part of the answer is in the Ruby programming language. Many things that are very simple to do in Ruby are not even possible in most other languages. Rails takes full advantage of this. The rest of the answer is in two of Rail's guiding principles: less software and convention over configuration.

Less software means you write fewer lines of code to implement your application. Keeping your code small means faster development and fewer bugs, which makes your code easier to understand, maintain, and enhance. Very shortly, you will see how Rails cuts your code burden.

Convention over configuration means an end to verbose XML configuration files--there aren't any in Rails! Instead of configuration files, a Rails application uses a few simple programming conventions that allow it to figure out everything through reflection and discovery. Your application code and your running database already contain everything that Rails needs to know!

Re:What is this? (1)

iwan-nl (832236) | more than 9 years ago | (#11844272)

I've never used Ruby myself, but judging from the text you quoted, RoR people seem to have a weak spot for superlatives and exclamation marks... Let's just hope their coding is more "super" than their writing.

Re:What is this? (1)

Cyberax (705495) | more than 9 years ago | (#11844014)

It's a collection of Java Best Practices rewritten in a 'cool' geeky language. Nothing new....

Re:What is this? (5, Insightful)

JamesOfTheDesert (188356) | more than 9 years ago | (#11844435)

It's a collection of Java Best Practices rewritten in a 'cool' geeky language. Nothing new....

Quite true. For example, Java Best Practice #1 is to avoid using long, detailed XML files for configuration, and instead use the programming languge itself, which is dynamically loaded and interpreted when needed.

Another Java Best Practice is to let the framework write the tedious boilerplate code for you. For example, in Struts, you just run

% struts myAppName
and you're halfway done writing your Web application.

Here's one more Java Best Practice: Avoid expensive , complex application server software, and do rapid development using the Web server that is built into the standard library. Then deploy to the Web server of choice with no code changes or quirky vendor-specific API hacks.

Re:What is this? (1)

Cyberax (705495) | more than 9 years ago | (#11845219)

I advise you to read "Better, Faster, Lighter Java" by Bruce Tate for a list of current best practices.

Re:What is this? (3, Insightful)

coldtone (98189) | more than 9 years ago | (#11845226)

Halfway done?! You must be kidding!

Being a java web developer, and using struts to build 3 different applications I have to say that enough is enough.

Struts is a very simple web framework, which will do several things for you.
Dramatically increase the size of your app.
Limit the functionality of your app.
Makes the code hard to read and follow. Just about everything runs though the struts config file.

The only benefit I see with struts is that is provides some clean definitions for code. (A place for display, a place for validation, a place for the work to be done) And gives you some tags to help with internationalization. (Just help mind you, if you need to have a totally different layout for a different language then, well you're screwed.)

I would only use struts again if I was writing an application that was to be localized and translated, and was working on a large team. Otherwise a well written set of JSP's will get the job done faster and will be easier to read.

Re:What is this? (0)

Anonymous Coward | more than 9 years ago | (#11845892)

sarcasm went over your head.. not that I agreed what he had to say...

Re:What is this? (1, Insightful)

tigeba (208671) | more than 9 years ago | (#11846006)

Please correct me if this is a mis-characterization, but RoR replaces maintaining long detailed XML configuration files with maintaing long, detailed database specific sql files.

Using RoR, you create a table and let Ruby dynamically determine a bunch of information about relationships and data types and then you access various properties of this data. You are also forced to use RoR's Object model (You have to extend ActiveRecord, correct?)

Using something like Hibernate, you write an object, then do something do describe it (Java Annotations, XDoclet markup, tedious XML configuration file) and It can create the DDL/alter tables on the fly for you, and you are not forced to extend any object.

To me each approach seems to have merit, as well as inherent drawbacks.

Re:What is this? (1)

davestar (680893) | more than 9 years ago | (#11844035)

Well, don't feel too bad. Even if you'd already read the previous article, you still wouldn't have a clue what this is:

"In Rolling with Ruby on Rails, I barely scratched the surface of what you can do with Ruby on Rails"

Re:What is this? (0)

ggvaidya (747058) | more than 9 years ago | (#11844145)

I was about to say, "This is part two, as mentioned in the brief, part one [slashdot.org] is still around and up, so you could check that up if you wanted a background", but part one didn't really have much in the summary either. Ah, well, this is Slashdot, you must be new here, etc. etc. JFGI [justfuckinggoogleit.com] .

Ruby is great (1, Informative)

boeserjavamann (655642) | more than 9 years ago | (#11843905)

too bad there isn't the big fellowship right now (besides japan, where it is bigger than python, whatever that means ;) i think its the most clean and powerful oo-scriptings language available.

Any interesting projects? (4, Interesting)

elh_inny (557966) | more than 9 years ago | (#11843916)

Has anyone actually done some interesting stuff that now works in a productive environment?

Re:Any interesting projects? (2, Informative)

Nik13 (837926) | more than 9 years ago | (#11844013)

Last time when Pt1 of the the article came out, in the discussions on /. some sites were pointed out (seemed like decent sites too).

I've been meaning to get around to add RoR to my apache (XAMPP) setup to try it out. Most of what I do at work is ASP/ASP.Net and I've been looking for something else (not to fully replace them, but perhaps as a complement). I'm not big on php, but it has it's uses and followers (I use it on some small websities with cheap hosting). J2EE isn't my definition of fun (although it's robust and all).

From what I had seen, RoR seemed pretty promising (and it keeps getting better they say), but I'll have to dig deeper to see it's full power. The only problem I can see now is finding some decent hosting for that, preferably cheap (RoR *with postgresql* to make things worse).

Re:Any interesting projects? (1)

orion024 (694922) | more than 9 years ago | (#11844171)

From what I had seen, RoR seemed pretty promising (and it keeps getting better they say), but I'll have to dig deeper to see it's full power. The only problem I can see now is finding some decent hosting for that, preferably cheap (RoR *with postgresql* to make things worse).

Check out http://www.textdrive.com/

Re:Any interesting projects? (5, Informative)

elmartinos (228710) | more than 9 years ago | (#11844026)

Shure! Even though Ruby on Rails is really very young, there are a few commercial sites that use it already. Here are a few links: Although, the first 3 links are somewhat related.

Re:Any interesting projects? (1, Redundant)

mrmargolis (781449) | more than 9 years ago | (#11844056)

Basecamp(http://www.basecamphq.com/): tens of thousands of users, designed by the creator of RoR 43Things(http://www.43things.com/): thousands of users, now working with Amazon.com TadaList(http://tadalist.com/): an online todo list app with thousands of users Snowdevil(http://www.snowdevil.ca/): an online store that is powered by rails. It was deployed very rapidly using rails. If you can get through to the onlamp article there is a more complete listing of real world RoR applications at the end.

Re:Any interesting projects? now with line breaks (0, Redundant)

mrmargolis (781449) | more than 9 years ago | (#11844082)

Basecamp(http://www.basecamphq.com/): tens of thousands of users, designed by the creator of RoR
43Things(http://www.43things.com/): thousands of users, now working with Amazon.com
TadaList(http://tadalist.com/): an online todo list app with thousands of users
Snowdevil(http://www.snowdevil.ca/): an online store that is powered by rails. It was deployed very rapidly using rails.

If you can get through to the onlamp article there is a more complete listing of real world RoR applications at the end

http://www.bellybutton.de/ (0)

Anonymous Coward | more than 9 years ago | (#11844205)

http://www.bellybutton.de/

Sounds exciting... (4, Interesting)

szlevente (705483) | more than 9 years ago | (#11843926)

"A Rails web application can run under virtually any web server"
Now that really made me curious. Is that really true, tried, and tested? If so, we need another bunch of tutorials about how to use Rails under Tomcat, Apache, etc. There is no way this framework will replace existing Java frameworks, but using it for prototyping is promising.

Re:Sounds exciting... (3, Informative)

zimba-tm (598761) | more than 9 years ago | (#11844020)

Some answers for those who are lazy

== ROR runs and was tested under :
Apache + CGI
Apache + FCGI
Apache + mod_ruby
Lighttpd + FCGI
WebRick (ruby server)

OS : Linux / Window / OSX / *BSD

== Real-life examples :
www.basecamphq.com
www.tadalist.com
www.43thi ngs.com
www.snowdevil.ca
www.bellybutton.de

English language logic format (0)

Anonymous Coward | more than 9 years ago | (#11844097)


In the world of computers, canonical always means real, and virtual always means fake.

For instance, a canonical host name is the real name. A virtual host name is a fake name.

So if somethings runs on virtually any web server, that means canonically it does not run on every web server.

Re:Sounds exciting... (1)

Nik13 (837926) | more than 9 years ago | (#11844116)

In this case, I guess "virtually any webserver" means either apache, lighttpd or WebRick. I couldn't find anything IIS related (not that I spent hours looking either).

DB wise, it supports MySQL, PostgreSQL, SQLite, MS SQL Server, IBM DB2 and Oracle.

Re:Sounds exciting... (0)

Anonymous Coward | more than 9 years ago | (#11844204)

It supports FastCGI [fastcgi.com] so pretty much any webserver that has support for FCGI should work. lighttpd [lighttpd.net] is my personal favorite (much less bloated than Apache). IIS has a FastCGI ISAPI plugin so IIS should be fairly easy.

Re:Sounds exciting... (5, Informative)

rubycodez (864176) | more than 9 years ago | (#11844237)

No way this framework will replace existing java frameworks

There is actually a chance it may become a mainstream way of building an enterprise framework. There is a very cool new bytecode Ruby virtual machine and just-in-time compiler (YARV), and the next generation of Ruby, Ruby 2, will support native OS threading. Unlike Java, the source for Ruby is and will be completely open & transparent. Ruby can run on platforms where java can't, like BeOS and MS-DOS.

Re:Sounds exciting... (1)

geniusj (140174) | more than 9 years ago | (#11844484)

Well.. BeOS and MS-DOS. That just seals Java's fate ;). Seriously though, I love Ruby.. The consistency it shows throughout the language is very refreshing. I can usually guess at syntax or method names if I don't already know them. We're on the same wavelength ;)

Re:Sounds exciting... (0)

Anonymous Coward | more than 9 years ago | (#11844855)

Unlike Java, the source for Ruby is and will be completely open & transparent.

What do you mean by that, other than something you've repeated from /.?

Re:Sounds exciting... (3, Funny)

drew (2081) | more than 9 years ago | (#11845190)

yeah, 'cause BeOS and MS-DOS are crucial platforms to support when you're developing an enterprise framework.

Re:Sounds exciting... (0)

Anonymous Coward | more than 9 years ago | (#11844607)

> There is no way this framework will replace
> existing Java frameworks, but using it for
> prototyping is promising.

Serious question: Why? I see this kind of framework as more useful than Java frameworks for many many production tasks. However, this kind of framework is sort of my "home turf". I'd love to see your reasoning.

Eivind.

Rails and other Rails tutorials (5, Informative)

teidou (651247) | more than 9 years ago | (#11843956)

To explain Ruby on Rails, I could say it is a highly integrated model-view-controller type web application framework. That would be like saying a Ferrari is a 4 wheeled internal combustion vehicle: true, but misses the point.

For more info, see RubyOnRails.com. An good alternative tutorial is at http://rails.homelinux.org/ [homelinux.org] .

There are even better introductory materials coming. Dave Thomas (of Pragmatic Programmers) is working on a Rails book, chapters are being reviewed presently.

Rails is powerful an flexible. More importnatly, it's a lot of fun. If you are a programmer who want to enjoy web-based application development, please do take a look at Rails.

Re:Rails and other Rails tutorials (3, Informative)

pamri (251945) | more than 9 years ago | (#11844259)

Another great resource is the Ruby on rails weblog [rubyonrails.com] which has links to more tutorials, job postings about rails, updates, etc., There's also an updated video [rubyonrails.com] tutorial on building a weblog.

Re:Rails and other Rails tutorials (1)

snorklewacker (836663) | more than 9 years ago | (#11844474)

> To explain Ruby on Rails, I could say it is a highly integrated model-view-controller type web application framework.

Rails is not really MVC -- The Controller part at any rate, the bane of every struts programmer, is entirely invisible in Rails. I suppose not having to deal with it yourself doesn't make it go away ... but really, nearly ANY application can be broken down into MVC parts or otherwise viewed through some MVC lens. The term was never all that meaningful (it only made sense when the controller was implementing low-level stuff like device drivers in smalltalk), but it's almost wholly meaningless for modern web apps.

At any rate, you tend to define look and behavior in the same file in Rails, which makes it rather not MVC. It's there to make programmers productive, not create divisions between coders and web monkey designers. You could template if you wanted to, you just generally don't. It's rather a breath of fresh air, actually.

Re:Rails and other Rails tutorials (0)

Anonymous Coward | more than 9 years ago | (#11844789)

That would be like saying a Ferrari is a 4 wheeled internal combustion vehicle: true, but misses the point.

I'm not sure you can really compare Ferraris with Ruby. Ferraris are blindingly fast and very short on comforts. Ruby is as slow as molasses, but extremely comfortable and fun to program in. It's more like a stretch limo than a sports car.

One thing has changed... (4, Informative)

WWWWolf (2428) | more than 9 years ago | (#11843968)

When the part one was published, I had severe problems getting Rails to work in Debian. There was a lot of really odd tools that needed to be installed and all that. Rails web page had tons of Ruby packages that I was pretty sure I didn't need...

But one thing has changed since then: Rails is now in Debian unstable [debian.org] !

Re:One thing has changed... (2, Informative)

pamri (251945) | more than 9 years ago | (#11844372)

Actually, rails/any ruby library/app/whatever is quite easy to install if it is available on ruby gems and you have installed ruby gems. ruby gems [rubyforge.org] is sort of like apt for ruby. Once you install gems, to install rails, all you have to do is, gem install rails and gem uninstall rails to uninstall rails. Although you are unlikely to need it. :-D

Re:One thing has changed... (4, Informative)

Tobias Luetke (707936) | more than 9 years ago | (#11844477)

Please don't make this sound like an rails or ruby issue. Debian really blew it on packaging ruby. Most of the system related problems which come up in #rubyonrails are related to debian linux installations.

How did they come up with the brilliant idea to split the standard library into 34 different packages? I just can't see how something moronic like this can even get started considering that a standard library is all about raising the status quo of the language by providing some shoulders to stand on so people can reach for higher goals.

Keep in mind that ruby has no dependencies at all. All dependencies are optional and the libraries using them (tk,x11, readline) fail gracefully with exceptions when the parts are not installed. Not so if the entire library is missing, this will cause a runtime exception with cryptic error message which rails will never be able to handle. Also ruby is tiny the entire package is 3mb!

I heard they are talking about improving the situation by adding a "virtual package" for ruby which contains all 34 seperate packages

Future in Debian terminology is traditionally not soon and thats a fix feeble fix considering all they need to do is to put all 3mb of ruby in one package

Anyways the point is fairly moot now since debian doesn't have ruby 1.8.2 anyways which is required for the latest rails

Luckily its easy to install ruby by hand. And I heard gentoo and freebsd install pretty easily too...

34 different packages (2, Interesting)

metamatic (202216) | more than 9 years ago | (#11844976)

Debian does the same thing to Perl, except there are substantially more than 34 packages. I'm not sure what the point is, as Perl has its own package management via the CPAN module. I wish Debian would let Perl do its own package management, like Gentoo does.

The entire Ruby system isn't 3MB, either, if you're calling those 34 packages the system. The log4r package alone is 1.1MB, libqt-ruby is another 1.3MB, and libxmlparser-ruby is 0.8MB.

And Debian does have Ruby 1.8.2, I run Debian unstable and I've been using 1.8.2 for a while now.

Re:One thing has changed... (2, Informative)

cortana (588495) | more than 9 years ago | (#11845174)

$ cat /var/lib/apt/lists/ftp.uk.debian.org_debian_dists_ sarge_main_binary-i386_Packages | grep-dctrl -n --field=Package ruby --show=Size

Summing the output, yeilds 31806976 bytes or 30 MB.

$ aptitude show rails
Package: rails ...
Depends: ruby (> 1.8), ruby ( 0.10.7),
libyaml-ruby (> 1.8.2), rdoc (> 1.8.2), libtest-unit-ruby (> 1.8.2),
libdrb-ruby1.8, libsoap-ruby1.8, libxmlrpc-ruby (> 1.8)
Recommends: libwebrick-ruby1.8, irb (> 1.8)
Suggests: libapache-mod-ruby
Description: MVC ruby based framework geared for web application development ...

If you see a dependancy missing from that list, please file a bug.

Re:One thing has changed... (0)

Anonymous Coward | more than 9 years ago | (#11845193)

Whoops, replied to the wrong comment. And setting the format to plain text wouldn't have hurt, either...

Re:One thing has changed... (1)

agrippa_cash (590103) | more than 9 years ago | (#11845699)

http://www.2sheds.ru/blog/2005/02/installing-ruby- on-rails-on-debian.php has a good tutorial which shows an alternate server for a acouple debs and from which you can just copy and paste the horrensously long atp-get command. Sadly, I get a 'permission denied' error chenever I try to run 'rails foo'. So maybe the tutorial wasn't that great after all.

Ah, Ruby... (-1)

Anonymous Coward | more than 9 years ago | (#11844095)

Because Perl is just too mainstream.

Re:Ah, Ruby... (0)

Anonymous Coward | more than 9 years ago | (#11844560)

Yes. Considering they're exactly the same language, with just one of them being more popular. Oh wait. They're not. Troll.

They don't have to be exactly the same. (0)

Anonymous Coward | more than 9 years ago | (#11844809)

The point is ruby is just perl with a less logical, but easier to read syntax. There's nothing you can do in one that you can't do in the other.

Really Getting Started in Rails (1)

slipnslidemaster (516759) | more than 9 years ago | (#11844117)



"(24)Slash7 is written & produced by Amy Hoy. a self-proclaimed renaissance woman who enjoys designing, coding, and writing for herself and others (but mostly for herself). Her business is infocookie Interactive and she can perform all of the above services for you. In her spare time she enjoys cooking, mucking about in her darkroom, and writing about herself in the the third person."


http://www.slash7.com/flashback/2005/01/oreilly_on lamp.html [slash7.com]

ROR rocks! (5, Interesting)

Pfhreakaz0id (82141) | more than 9 years ago | (#11844132)

As a guy who has written db-driven web apps in ASP, asp.net ( alittle), perl CGI, plain JSP/Servlet and j2ee app server with EJB's (both with and without a persistence framerwork/Object-relational bridge), I can tell you ROR is my favorite. I've only been using it for two weeks on a part-time project. It's ... beautiful. I can't think of any way to describe it. It. Just. Works.

And ruby is a really nice scripting language. You should check it out.

Re:ROR rocks! (3, Interesting)

pepicek (710120) | more than 9 years ago | (#11844252)

The best way to describe ruby and rails for me it's that you are writting programs for you to understand them, not for computer. It's really changing the way you think when you are programing. You have time to focus on bussiness problem rather than computer's. Even if you have Mac OSX and really love it :-).

Re:ROR rocks! (1, Interesting)

Anonymous Coward | more than 9 years ago | (#11844293)

Hi, I'd like to learn some new stuff. I've decided that Ruby is my new project. I'm coming from the point-of-view that I haven't really programmed at all in a long time (not since I took some classes in school, other than programming some excel macros in vba). Any suggestions where I should start with Ruby. Initially I've been taking the random approach; I've got Ruby (and Tcl) installed, and I'm just looking at tutorials and adding text boxes, and stuff like that. Any suggested easy first projects that really help someone learn Ruby? I want to find a project that will be (a) easy at start, but can grow more challenging, and (b) that I will find useful (I figure that'll keep me focused)... Any suggestions?

Thanks,
-dan

Re:ROR rocks! (1)

Pfhreakaz0id (82141) | more than 9 years ago | (#11844379)

Dan: hmmm, I'd find an itch to scratch. You can start by install rails and go thru the "todo list" tutorial web site. That's what I did. Maybe that will fire some ideas. Want to write a blog? write your own little blog site. It would be pretty trivial to do in rails.... I dunno.

hmmm...maybe not (0, Troll)

Anonymous Coward | more than 9 years ago | (#11844229)

While I'm not one to cast doubt needlessly on new, different ideas, I must admit that while the Ruby on Rails tutorial was spectacularly simple and fast, the fact is that when I decided to move from toy to trying to implement it, I encountered a number of problems.
First, the database that I hooked this framework to was not empty originally. After hooking the framework to that db, the data disappeared...I should repeat that, my data disappeared without my explicit instruction to destroy the data!.
Second, getting this running on linux was problematic because the tutorial was strictly for Windows and thus missed a few bits about linux (not really the author's fault since he admitted that linux takes more work).
I should be honest and say that after I discovered that RoR was truncating my database every time I tried to use it (without notifying me of that fact), I ran away in horror. I now use Zope [zope.org] and won't go back to RoR.

Re:hmmm...maybe not (0)

Anonymous Coward | more than 9 years ago | (#11844522)

It does say to create a new database, no?

Its worse than that. (0)

Anonymous Coward | more than 9 years ago | (#11844714)

If you want to do any testing, rails expects you to have the ability to drop and create databases. And all the development is mysql based, so if you actually try to do anything non-trivial using another database, you end up with it spewing errors instead of working.

Re:hmmm...maybe not (0)

Anonymous Coward | more than 9 years ago | (#11845223)

Well that's a bunch of BS.

Rails isn't doing to drop your entire database. ActiveRecord reflects over the existing structure to provide a convenient object interface to your database. It doesn't modify the database schema.

In fact, I know of no place in the entire code that issues a DROP TABLE or the like. It's certainly possible to do smething like MyModelClassName.find_all.destroy, but that's to be expected. It's just doing what you tell it (similar to rm -r /).

If you don't believe me, you're welcome to examine the source [rubyonrails.com] .

I haven't read slashdot for a couple years now, and now I remember why. It's a sandpit of innaccurate claims.

What rubbish. (0)

Anonymous Coward | more than 9 years ago | (#11844366)

This line from the tutorial says it all

"Hmmm. Now that's different. The MyTest part of the URL maps to the newly created controller. Now it seems that Rails tried to find an action named index in this controller but couldn't."

I've tried using it and it's rubbish.

Agile Web Development With Rails (4, Informative)

Ridgelift (228977) | more than 9 years ago | (#11844451)

Dave Thomas' new book "Agile Web Development With Rails" [pragmaticprogrammer.com] is due out in July. It's really, really good so far (I'm one of the lucky ones who is helping review it). My perspective is a person who knows very little about databases, web application development and no previous knowledge of Ruby, the language that Rails is built on.

One of the big problems with Ruby on Rails [rubyonrails.com] is that it [rubyonrails.com] is [rubyonrails.com] well [rubyonrails.com] documented [rubyonrails.com] , but a lot of it is API's and reference documentation. Dave's new book has an excellent tutorial which is the best thing I've seen written so far about RoR for newbies, and promises to go into the depth and detail similar to his Pickaxe [pragmaticprogrammer.com] book.

If you've previously looked at RoR and were disillusioned because you just weren't "getting it " or didn't want to slug through the technical documentation, I encourage you to keep an open mind and wait until Dave's book is released. I'm finally getting over the hump with RoR and I now see what all the fervour is about.

(Oh, don't ask me to post or send copies of his drafts, 'cause I ain't gonna!)

Re:Agile Web Development With Rails (1)

__Maad__ (263535) | more than 9 years ago | (#11844644)

One concern that I have about this is: How long has this book been in the works? Rails has gone through leaps and bounds and fairly huge changes( sometimes on a week-to-week basis) even in the few months I've been working with it. Will the book be up-to-date when it comes out?

Re:Agile Web Development With Rails (1)

Ridgelift (228977) | more than 9 years ago | (#11845245)

One concern that I have about this is: How long has this book been in the works? Rails has gone through leaps and bounds and fairly huge changes( sometimes on a week-to-week basis) even in the few months I've been working with it. Will the book be up-to-date when it comes out?

It's current up to 0.10, the latest version. David Heinemeier Hansson, the author of Rails, is also on the review team and seems to be good friends with Dave Thomas. So I think it's fair to say the book will be faily up to date, but like all technical books on new products it will date quickly.

Re:Agile Web Development With Rails (0)

Anonymous Coward | more than 9 years ago | (#11845510)

Am I the only one concerned that the reviewer for a book on web development using ruby admits he knows next to nothing about web development, databases, or ruby?

Re:Agile Web Development With Rails (3, Informative)

Ridgelift (228977) | more than 9 years ago | (#11845596)

Am I the only one concerned that the reviewer for a book on web development using ruby admits he knows next to nothing about web development, databases, or ruby?
I'm one reviewer amongst 22. I would say all the rest of the reviewers are much further along than I am, including DHH who wrote Rails.

Dave Thomas is looking to write a book that will help people learn Rails. My big contribution other than grammatical and spelling errors is "Hey Dave, I don't understand this section you say is easy".

To me, it's smart to let the uninitiated in so he can see if he's reaching part of his target audience: the ignorant :-)

Re:Agile Web Development With Rails (1)

E_elven (600520) | more than 9 years ago | (#11845944)

Yeah, gee, wonder why a tutorial would need to be read by an uninitiated person to ensure it actually teaches something. What a sham.

Comparing RoR with Java solutions (4, Interesting)

MarkWatson (189759) | more than 9 years ago | (#11844470)

I have worked through the RoR tutorial and re-implemented a simple admin web app that I originally wrote for a customer using JSPs and Tomcat. I must say that what took me 4 hours to write using JSPs and JDBC took about 30 minutes using RoR.

A big advantage that Ruby and Python have over Java is that they are dynamic languages that makes it not too difficult to write a database wrapper class that dynamically looks at database/tables meta data and generates access methods on the fly. Java Tails (using XDoclet market tags) can't really compete.

I really love the full J2EE stack for developing large scalable web applications but I am now looking at alternatives for creating smaller systems much more quickly.

BTW, I really like RoR's templating scheme: much like JSPs in syntax (JSP non-XML syntax, that is) but do to Ruby's much terser notation for enumerating collections, the the templates tend to look a little cleaner.

For Python, I really like the light weight CherryPy web application framework. I plan on checking out Python Subway also when I have some time.

-Mark

Re:Comparing RoR with Java solutions (4, Interesting)

dDrum (727937) | more than 9 years ago | (#11844648)

There is a version of rails in java.
It's called Trails and it uses spring, hibernate and tapestry.

Site - http://trails.dev.java.net [java.net]
Tutorial - https://trails.dev.java.net/tutorial/" [java.net]
Trails in action - https://trails.dev.java.net/media/trails_withnarra tion.mov [java.net]

It's still beta but you can try it.

Re:Comparing RoR with Java solutions (2, Informative)

jimm (5532) | more than 9 years ago | (#11845235)

When you watch the "Trails in action" movie be aware that each time he does a redeploy, the ant task takes about 37 seconds. With Rails, it's about one second.

Re:Comparing RoR with Java solutions (2, Interesting)

Paradox (13555) | more than 9 years ago | (#11845485)

Compare the Trails video with any of the Rails videos. It's kind of sad really. The trails video does less than what the Rails video does, and it takes much longer, is more complex, and relies on an IDE. Bummer for Java.

I'm not sure that Java can be used to replicate Rails. It might be possible, but it would probably mean abandoning a lot of existing infrastructure. Ruby does a lot of very clever/strange things, like dynamically adding methods to classes based off database schemas. The best we've seen Java do thus far is do this kind of thing statically via code generation and hints garnered from the source file comments.

Trails is a neat idea and it does bring some great things to the table when it comes to Rapid Web Application Development, but it isn't fair (for Trails) to compare it to Rails... at least as of yet, anyways.

Rails got me curious about Ruby (2, Interesting)

MSBob (307239) | more than 9 years ago | (#11844738)

The Rails is such a great showcase of Ruby it really got me interested in the langauge itself. In particular looking at their Object Relational mapping tool it's very impressive how easy it is express your mappings with very little effort. Have a look at this example [rubyonrails.com] and compare it to a typical set of java classes with Hibernate tags. Then in case of Hibernate you have the extra build steps with Ant to generate the hbm files and so on. Don't get me wrong I like Hibernate and use it every day but Hibernate must operate within Java's syntactic limitations. With Ruby there is so much more flexibility that helps Rails achieve much more simplicity and expresiveness.

Re:Rails got me curious about Ruby (0)

Anonymous Coward | more than 9 years ago | (#11844911)

set of java classes with Hibernate tags. Then in case of Hibernate you have the extra build steps with Ant to generate the hbm files and so on.

The hibernate tag issue is a one time event: you make them and that's it. You can even make Eclipse generate simple ones for you when you make the getters and setters for fields. Granted you'll have to edit them in the case of collections.

As for ant you put that task of generating the hbm files in your general deployment task. Also you only have to do it when you change your business object definitions as they relate to the database.

Re:Rails got me curious about Ruby (1)

MSBob (307239) | more than 9 years ago | (#11844946)

And that's still much too much legwork for most developers' tastes. I have worked with Hibernate for the past two years and know the library and the supporting tools inside out... and I still cringe every time I have to create this complicated setup just to have my OR working.

Personal Testimonial (1)

orion024 (694922) | more than 9 years ago | (#11845377)

A few years back I created a dynamic MySQL backed website in PHP. When I first started learning Ruby, I converted this site to Ruby (ala eRuby and mod_ruby). I easily cut my code in half, *plus* it became a whole lot easier to read (and I was a ruby-newbie!). I am now migrating the site to use Rails, which, from what I can tell so far, is cutting that code down in half *again*.

If Rails had been around when I first started the site, I would have saved hours upon hours of development time. Rails is an amazing framework. It's cut down my development time, and my code is easy to read. It's made web-development *fun* again.

Their most recent release (0.10) provided support for writing (and using!) web services. I've already written one and put it into production with a VisualStudio C# app. Great stuff.

This is an amazing technology (2, Informative)

badboy_tw2002 (524611) | more than 9 years ago | (#11845645)

I don't normally write cheerleading testimonials, but its also rare I find something this cool that I want to gush about it.

The first tutorial (I saw it right here on Slashdot!) got me curious about RoR. I went home and installed it that night. A couple weeks later (total of maybe 10 hours invested) I had completely converted my community website over to rails (from a servlets site), and am launching it fairly soon. The funny thing is, the actual code to drive this thing is really small. No boring, repetative database code, automatic validation, lots of helpful classes (authentication is downloading a new package and running a make script). Things in the tutorial make it look like you're limited to standard naming conventions, but I assure you that you can override everything if you've got an existing database that doesn't match the RoR naming scheme.

I've found the community very helpful. Hosting is a bit limited now, but I'm getting a textdrive.com account soon to get my new site up and running.

This is definately worth an install and the 20 minutes it takes to do the tutorial, check it out!

Easy to install on a host that doesn't have it (1)

inventric (852946) | more than 9 years ago | (#11845911)

My webhost (http://www.inventric.com/nicewebhost [inventric.com] ) didn't have it out of the box either. And many people think if their webhost doesn't have it they are out of luck.

I wrote a tutorial on getting Rails installed without having root access. The tutorial has some specific stuff for my webhost, but it might give you some ideas on getting it installed for yourself.

The tutorial is at: http://www.inventric.com/blog/2005/01/ruby-on-rail s.html [inventric.com]

I've tried RoR (0)

Anonymous Coward | more than 9 years ago | (#11845732)

And there were two main problems:

1. It didn't install without a lot of effort (it took me 3 weeks on and off to get it working)
2. After all that, It deleted all my data without telling me.

This may sound funny at frist, but I accidently set it up on a production system, so it turned out not to be so funny.

As a result I've gone back to the technologies used in the advertisment embedded in this story (Microsoft Visual studio.net) . Like the ad says: "Create high performance web applications, and watch your throughput go through the roof". Never a truer word spoken. And I doubt it'll wipe my production system clean of all it's data any time soon.

The irony.

Ruby? (1)

mikehunt (225807) | more than 9 years ago | (#11845765)

Anyone who wants to post reasons for why I need to learn yet another language?

Like why I need to learn another set of editor commands...?

Mike.

Re:Ruby? (1)

Paradox (13555) | more than 9 years ago | (#11845928)

Because if you don't learn Ruby, you can't use Rails. Rails is so compelling, you'll learn Ruby just to use it. Then you'll realize how incredibly cool Ruby is as a language, and how incredibly productive it is at the same time. And in the long run, you'll be better off for it.

Yes, Ruby is that good. Rails is a very nice framework, and it does things that you couldn't do easily in other languages (and that includes Python).

As for editor commands, didn't you know only Emacs users get into heaven? ;)

Re:Ruby? (1)

mikehunt (225807) | more than 9 years ago | (#11846041)

Oh shit...I'm I vi user. On all platforms. Like I say, life is much too short for yet another editor!

Ruby seems interesting, maybe once I've swallowed VB and Java, I'll get around to it.

Mike.

Frameworks closely tied to languages, WHY (2, Insightful)

Tablizer (95088) | more than 9 years ago | (#11846002)

Anyone who wants to post reasons for why I need to learn yet another language?

Indeed. Why can't somebody make a fairly language-neutral framework? Why are all the UI frameworks so tightly bound to specific languages and why do people accept that?

Things like data/field dictionaries, screen descriptions, UI widget attributes, and event handling frameworks don't need to be closely tied to specific languages because they are mostly declarative in nature, so why are they in practice?

It just does not seem very efficient to reinvent the wheel for each and every language. There about 100 languages in popular use. If we reinvent a web/ui/gui framework for each and every one, then we have spent 100 times the effort than need be. (Well, adaptors and sharing for similar langs may make it more like 50.) It would seem wiser to make one standard and do that one really well instead of do it 50 times poorly for each lang. We managed to divorce database usage from being language-specific. Time for UI also.
Load More Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account

Loading...