Ajax On Rails
mu-sly writes "Ajax and Rails - probably two of the biggest buzzwords in web development at the moment. In this article over at ONLamp, Curt Hibbs introduces the incredibly powerful Ajax support that is part of the Ruby on Rails web application framework. It's a great read, and serves as a gentle introduction to the cool stuff you can accomplish with ease using the Ajax features of Rails."
Yeah, conf I'm at right now (NFJS) the dudes are pimpin' the ride with rails. FWIW.
please....
I'm sure many developers like myself have a day job that probably involves J2EE. The first time I did the iniitial tutorials for Rails several weeks ago I was blown away. Connecting to a database is not susposed to be this easy.
Even when using newer frameworks like Spring, Tapestry and Hibernate (I hate you so much Struts) Rails still manages to be easier.
I highly suggest any developers looking for a change of pace at least give Ruby on Rails a few hours of your evening. While it's not nearly as comprehensive as Java, it's gaining libraries and functionality by leaps and bounds.
And just so I don't get labeled as a Rails fanboy/Java basher: Rails is not perfect, I still would recommend using J2EE for large corporate projects. It's just a much more mature solution with less unknowns. I think Rails needs another year at least before people are ready to really give it a shot in the corporate environment.
ce n'est pas un Sig.
Can this again help reducing bandwidth consumption in a similar, but prettier way, than html frames?
Every time I see material surrounding Ruby on Rails, I'm further convinced that it could be the web application programming foundation that starts to displace PHP as developers start to look at the transition from PHP 4 to PHP 5. Getting an increased install base for ruby on rails, as is the case with php (a fairly difficult task, admittedly) would definitely help no end in increasing the framework's popularity, at least amongst those programming smaller web applications.
Business Voyeur
Get the Beta book http://pragmaticprogrammer.com/titles/rails/index. html
If you're interested in Rails at all, this book is all you need.
b) Microsoft's own technology being used by Google to loosen Redmond's deathgrip on the market?
Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
Of course Rails isnt the only completely F/OSS web application framework; Rails is best when you want to put relational data online: It's edge is it's simplicity.
On the other hand remember Zope - If you can get your head around Aqusition, the ZODB and Product Deveopment then Zope is a super-fast development platform.
From the article:The most visually impressive of these is Google Maps, which gives you the illusion of being able to drag around an infinitely sizable map in its little map window.
It's illusory alright, when I start at the US and scroll due west the first thing that I come to is the UK. Where'd all the other countries go?
Ajax grew from one of those hated, non-standard Microsoft features.
Help me take back Slashdot. When did 'News for Nerds' become 'FUD and Conspiracy Theories for Extremist Nutjobs'?
The rise in AJAX is almost solely due to the recent AdaptivePath article. I'm not sure it's a major trend.
n ews.png
e vsrubyDejanews.png
http://www.realmeme.com/miner/technology/ajaxDeja
However, Ruby on Rails is clearly rising,
moving steadily upward for over a year. Thanks to a reader for bringing this to my attention.
http://www.realmeme.com/miner/technology/hibernat
how is this better than ASP.NET?
the "Traditional Web App" is still running, but the "Ajax Web App" is down.
This tells me everything I need to know about this amazing technology :-P
Most of this product comparison site was developed in Ruby on Rails within the last two months, and it already does more than Froogle, has more search features, etc.
I've also developed a large marketing system for the restaurant industry in Rails which lets restauranteurs develop e-cards, e-gifts, and send them to their customers on certain days.. or certain days away from their birthdays, etc.. and that will be going fully live soon.
My 10,000 user strong RSS Digest will be making the leap to Rails soon (July 1st) and this is a system driving over half a million uses a day.
I developed a del.icio.us-style tagged Code Snippets site in Rails within two days! It's had further refinements since then, but less than two weeks after launch, it was getting thousands of pageviews a day and hundreds of visitors a day from Google.
I was ready to give up development work 6 months ago, and now it's the most fun and profitable work out there for me. Ruby on Rails deserves the attention it's getting. You can put together your ideas in a fraction of the time you'd have ever imagined.
I love Rails as much as the next guy, I'm using it for every new project. But this thread is about ***AJAX*** in Rails, is it not?
Does anyone have experience yet with *AJAX* in Rails? I'm about to play around with it right now. Can anyone please comment on THIS ARTICLE instead of babbling around the point?
Thank you.
First thing this title reminded me of was Cheech & Chong's Up In Smoke. That chick does a couple rails of ajax that Chong was cuttin up for fun. I was surprised no one else posted about it.
You're nothing; like me.
Time to add Ajax and Rails on my resume!
(To all potential employeers: I kid!)
The surprise isn't how often we make bad choices; the surprise is how seldom they defeat us.
Has the performance of Ruby gotten much better since the early days?
I started using Ruby a long time ago, back when no one knew about it. I liked it because it was like a better Perl (better OO support but with Perl syntax). However, I quickly tired of its lackluster performance. I mean it was a lot slower than even Perl or Python. I eventually moved on hoping to return when Rudy had matured and performance was kicking. Last time I checked the performance was the same as always. So much for the "tune for performance later" crap. When will programmers learn that doesn't actually work? You need a good design that includes tuning for performance early on.
Now I know Ruby on Rails has been shown to be faster than J2EE and similar but that's just a small part of what Ruby can do. Everywhere else it doesn't seem to perform as good. Sorta like Java. Good for server-side web stuff (mostly due to the nice API's really) but suck-ass at everything else.
The ratio of people to cake is too big
Try the examples ... http://blog.curthibbs.us/articles/2005/01/01/ajax- on-rails
...
It looks like Ruby is not primetime, I get this error
Application error (Apache)
Change this error message for exceptions thrown outside of an action (like in Dispatcher setups or broken Ruby code) in public/500.html
I first heard of Ruby on Rails here on Slashdot. Although Rails is dead simple once you get it, getting to the "ah ha" point is a bit of a steep climb.
If you want to learn Ajax in Rails, the best thing I've read has been Dave Thomas' new book "Agile Web Development with Ruby on Rails". The author of Ruby on Rails itself, David Heinemeier Hansson, is also a co-author. Great book, absolutely fantastic web development framework.
Ruby on Rails Screencast
On Railsday (a 24 hour ruby on rails competition), myself and a couple of pals built a "Ajax" powered game on top of google maps. I'm not going to put a live link to it. (each client does xmlhttprequests to the server for status ASAP, and I don't want my poor server to die)
See Britt's write up and my (Jesse's) write up, Rails Day SVN source for all the projects.
Then using that I was able to build Geo-comments into my rails based blog with a couple hours work... When leaving a comment, you leaving your zip code, and then the geo-comments view using embedded google maps to show who has said what
That one girl in that Cheech & Chong movie snorted a rail of ajax thinking it was coke..
That was funny.
It's best to be suspicious of this framework until it has a nicely integrated mechanism for graceful degradation of the user experience in clients that don't support Javascript.
I used to think, like the tadalist folks, if you aren't willing to upgrade your browser, screw you. But that was before my mobile web client began being an ever-more-important part of my systems for managing my personal data on the web. Most mobile devices just don't support Javascript, and even if you find one that does, it isn't that quick or easy to switch devices, with many such devices being cell phones that have contracts. These days if a site doesn't support plain HTML, it's as if it doesn't work at all, unless you are tied to a desktop.
There certainly are AJAX apps out there that do gracefully degrade the UI on HTML-only clients. But the rails stuff I've seen so far are not among those.
our new scripting overlords who feed us ajax rails.
by TheSpoom (715771) Uncaring Linux user here. I have nothing to add to this but please continue. *munches popcorn*
heaps nice.
You can bend the rails pretty violently if you need to as well, which is what makes the inbuilt 'sensible defaults' a useful starting point rather than an ultimate obstacle.
And the rails source code is written in Ruby, so you can a) read it, and b) fit enough of it on your screen to grok what's going on.
Go buy the book.
---- death to all fanatics
The article has two links intended to allow the reader to compare a traditional web app to Ajax.
In Firefox 1.04, the 'traditional web app' link doesn't work: the form for posting comments doesn't appear. (It does work in IE).
The Ajax link throws up an error message:
Not all that impressive!
Would anyone care to post their experiences with any of the libraries - DWR, Prototype, Sajax, and Ajax.NET (i'm not interested in this one at all, but to be fair...) - mentioned in TFA?
"Our interests are to see if we can't scale it up to something more exciting," he said.
As mentioned in Curt's great article, the Agile Web Development with Rails (beta) book has a nice chapter on Ajax support. You can even get an extract of the chapter at the pragmatic programmer's site: PDF Extract of Chap 18: Web 2.0
Figure 18.1 should make Ajax clear. The book is highly recommended, and the 2nd Beta was just released last week.
Matz is well aware of the speed problems, and unlike ruby zealots is at least willing to admit that its a problem, and plans to make ruby2's performance competitive with perl and python.
Can anyone who has experience with this comment on how well this works with various browser versions, older and newer?
Traditional Web App (at this moment running fine)
Ajax Web App (Crashed / burnt)
--> Insert Funny Sig Here
I'm not a programmer, but someone who pays a programmer to develop a web-application for which PHP is used. It is possible to mix PHP and RoR, making a gradual transition possible? The FA surely mentions types of behaviour I'd like to have. Bert
AJAX (Asynchronous JavaScript And XML):
Acronym for a programming technique. The acronym was coined by AdaptivePath, but the technique existed long before the acronym arrived. In AJAX the client browser uses JavaScript/DHTML to send/receive HTTP requests in the background from a hidden frame (or IFRAME) or by using the XMLHttpRequest object, while maintaining a persistent GUI for the user. The intention is to reduce the "request-response" nature of web applications and provide a more X- or Windows-like GUI interface for web applications. Although AJAX is hyped as new, only cross-browser support of the XMLHttpRequest object is new. The "AJAX" technique has been around a long time: e.g., ESRI, the mapping company, has used the technique for years in web apps.
Ruby on Rails (RoR):
A web application framework that includes a web application program generator, a database, and the Ruby language (and optionally a web server written in Ruby). The program generator accepts a description of database tables and generates generic Ruby code (web pages) to do CRUD (create, read, update, delete) maintenance of each table. With very little initial effort one can create a (very) basic web application.
Main weaknesses:
Both RoR and AJAX are being pitched to communities not particularly skilled in development. This is unfortunate since only a skilled developer can fully utilize either. Developers who use PHP or Perl will see little new in RoR or AJAX since program generators and frameworks (e.g., MayPole, Catalyst, Class::DBI, CGI::Application, Mason, EmbPerl, etc.) have been available for years in Perl and PHP.
If you have a simple CRUD website that will remain simple, then you might experiment with RoR, (but I would not). I don't recommend AJAX under any circumstances, because of the high maintenance issues.
Comparing lighttpd + fastcgi rails to tomcat is just retarded. That's the fastest rails configuration vs one of the slowest java configurations. Tomcat is a very slow reference implimentation, java web apps are almost never deployed using tomcat. Repeat the benchmark using a reasonably performing java server (resin is free and fast) and then compare numbers.
libedit is a free replacement for libreadline, which oracle could use without any problems at all. They choose not to because they do not care about making their product usable.
ASP.NET 2.0 does this also. You can define client callbacks on web controls which let you run code on the server-side and get the results back without reposting the page.8 96
http://www.developer.com/net/asp/article.php/3506
I am sick of seeing this excuse. You can't run around the internet screaming how rails is the greatest thing since the wheel, and how it renders java obsolete because its 100x faster to work with, and then say "its not done" when people actually try to use it. If you are ready to hype something and tell everyone how great it is, then you need to be ready to accept criticism too. If we can't compare it yet because it isn't finished, then stop running around telling us how great it is and how we should all be using it.
You can still cache over the network. Pulling an object out of a simple key/value hash which is stored entirely in RAM (memcached) is significantly faster than parsing an SQL query, retrieving all the data, and then making an object out of it. And it also allows your database to only have to deal with queries that MUST be done, instead of fetching the same things over and over again for no reason.
Ok. So someone built a webpage with java script rich client features and some server stuff to deal with it. Right? Well, this is as old as the hills. Web developers where doing this 5 years ago.
But this is called Ajax and suddenly everyone goes crazy.
Then there is ROR. I checked Ruby on Rails about a year ago. Then again a little more just the other month. It looks like Zopes younger brother. Not half as powerfull, and 5 years to late. But with Ruby, as to add even more extra geekness or what?
Please understand: I think all these OSS PLs, Appservers and Web technologies are great. I love to use them for my work, and when a new one pops up - it happens every odd week - I'm the first one checking it out. I just would like to understand what all the extra excitement is about.
Could someone please explain? I'm serious.
We suffer more in our imagination than in reality. - Seneca
These are "hot" technologies?
I haven't heard jack-all about them. Then again I don't make my living doing web apps so who knows.
I've been working with struts as of late, and although setting things up can be a little tedious, what specifically don't you like about it?
I didn't say nobody uses it. I said almost never deployed. You can get lots of offers for PHP too, that doesn't change the fact that its slow. Like I said, comparing the fastest rails setup to one of the slowest possible java setups is dishonest.
I very clearly stated that you can cache over the network, and pointed out why a network cache like memcached is faster than an RDBMS. Your post has nothing to do with what I said, so why is it a reply to me? And you can just pull an object from the cache with memcached, because every time you update the db, you also update the cache.
ok i had to post on this
i'm just sick of people rejoicing about AJAX
doing stuff FLASH does since like 2000..
OMG SERVER LOAD NO PAGE REFRESH !@#$%
that is all.
/// evilloop.com
I only have a few comments about the web-development community in general, relating to the technologies under discussion.
It seems to me that the majority of web developers program in javascript for the browser and then use something like ruby, python, perl, or even php on the back-end. And even though PHP is very similar to javascript, it isn't.
It saves me so much time to write code once, and be able to use it on the front-end as well as the back-end.
Now, with the ability to load content AND CODE dynamically into the browser, doesn't it make sense to write back-end code in JavaScript as well?
I've been doing "Ajax" (hate that name!) since 2000, and it is still difficult to convince the back-end coders at work that it is a good thing. They all code in VB/VBScript. One or two know javascript for the browser, but don't use it at all on the back-end.
I know and have used many other languages, for over 25 years, and I have found that javascript is univeral, extremely solid, and powerful. It is as robust as the developer(s) using it.
--my $.02 towards increasing Javascript's popularity and market penetration.
In the mid-90's the best tools for developing data-centric client/server apps where VB, Delphi, Powerbuilder, and Clarion. They fell out of favor because management wanted everything webatized. This was partly out of fad chasing and partly because deployment over the web is usually a lot easier.
I would like to see interface kits take the best features of these four and create HTTP-friendly protocols for using them: a Biz-GUI browser. HTML+JS+DOM is growing into fat-client technology anyhow, just a messy set.
Table-ized A.I.
There seems to be a lot of RoR fanatics out there. Why are they so sensitive to criticism?
The little demo they have on ONLamp has a tiny little mention of unchecking a particular checkbox on your MySQL install. You know. To turn off authentication of username/password to login to the database. They claim that MySQL broke authentication in 4.1.9.
Whatever.
My DBD::DBI applications are able to athenticate against MySQL just fine, but this app throws large gaudy errors when trying to connect to my (non-crippled) MySQL instance. (Yes, I ran through the tutorial in the hopes that the bug would have already been fixed)
Rails is a great toy for running on your Windows-only development server. When it comes time to actually point it to a database, you're screwed. I might recommend to the developers to use an existing DB abstraction layer.
fifth sigma, inc.
They use the exact same Javascript library that is used in Rails as well: Prototype.
Rails is pretty decent. I guess the only issue is performance... you pretty much have to count out your typical web hosting account and have your own server. Mod_ruby pretty much takes care of the performance issues and it installed without incident in my Apache 2.xx web server with PHP 5.
Like many other people here, I realized that the whole Rails paradigm is great for new schemas and sites and will not fit well into my old crufty database schemas.
Newsfollow.com
ASP.Net has a LOT of new and very impressive features. I was blown away when I tried it (so were my co-workers). It's nice to have "Ajax-like" controls, but that wasn't the selling point for me.
.Net framework. It has user groups and roles as well. Combined with profiles, these 2 things save me about half the work on most projects.
:)
... Been a good time, but the ride's over. ASP.Net 2.0 is like a revolution. A next generation tool/platform. Microsoft have really done a great job of it. Once it's out on November 7th, I think it'll start getting a lot of well-deserved attention, and eventually get adopted by a lot of companies. I've already got myself ASP.Net 2.0 beta hosting :) I'm not looking back to anything else anymore.
A few new things...
Complete separation of code and HTML (code behind). No more generated-on-the-fly HTML by some snippets of code everywhere in your HTML (ala PHP). The code is compiled as well, and it'll run faster than all the parsed & interpreted stuff (like PHP). It makes it harder for others to shamelessly steal your code.
Caching! A new and very powerful feature. Pages have output caching - no need to render it every single time it's requested. It also caches the data source - no "trips" to the SQL server if the data hasn't changed. (Used with stored procedures, you get VERY fast and scalable app).
Sessions have been improved. They are shared across all webservers in a cluster. The new profiles are very powerful. No need to save or retrieve them either. As soon as a user logs in, you can start using their full profile and make modifications to it.
Login system (Forms, NTLM, etc). Are you sick yet of creating a new user manager for every new project? Well, that's history. With ASP.Net 2.0, you can have complete LogIn, CreateUserWizzard, ChangePassword, LostPassword solutions with exactly 0 lines of code to type - that's right! No code AT ALL! It's all taken care of by the
Sick of writing tons of javascript for onchange/onsubmit validation (as well as server-side validation) for every form? Well, again, there's form validation components. Nothing to code. Add them to your form (there's some RegExp validators too), and you're done. Major time saver!
Everything has excellent data binding (like, bind the "themes" or "skins" of all web controls to a user's preferences in his Profile - nothing to code at all!)
Tired of all the server side includes for headers/footers/menus? No need for that anymore! Master pages take care of it all.
WebParts let everybody pick different things they want (or don't) to see on their customized view of the webpage. Easy to use, and everybody has the web pages the way they want them. Definately welcomed!
New data access controls. More powerful, less code.
It's supposedly a LOT faster than J2EE.
Stability wise, it's a lot better too. It has health monitoring (can notify you) and it self-recovers.
Projects are easy to deploy on other servers.
And the new VS.Net 2005 really rocks
Have a peek! Guided Tour
I was wondering lately if I wouldn't be switching to another language/platform for web development, and I couldn't really pick anything superior. Well, I've found it. Nothing comes even close to it. It's not the usual "develop faster!" claims - this time it IS faster, you'll be amazed! And everybody else I've shown it to has adopted it too.
Bye bye Java, ASP, PHP,
+1, Well Met. (-:
Got time? Spend some of it coding or testing
Try it before talking out of your ass. Its not an ad-hoc network cache system, its a simple, VERY FAST cache that stores objects in RAM. If you are too stupid to grasp why this helps, go read about how it saved livejournal thousands of dollars that they would have had to spend buying a huge DB server and still had worse performance.
...of urpmi "postgresql-server; createdb mydbname; psql mydbname" but has used Oracle a few times, I have to say: Amen, brother, amen!" (-:
Yes, sqlplus is one of Oracle's big minuses (and not just the lack of readline). Yes, I'm aware that there are many replacements and that Oracle has to be configurable in detail in order to be able to scale, but you shouldn't have to deal with all of that rhubarb up front. It should remain politely anonymous out of the box until you explicitly ask for it.
You should be able to type in one or two non-obscure commands and at that point be able to bang in SQL92 or whatever and get stuff running. You can do it in PostgreSQL, ibFirebird or (albeit slightly weirdly) MySQL and others, why not Oracle? Can't they afford to make it easy to use out of the box?
Got time? Spend some of it coding or testing
Cyberax, you come across like a VB programmer bagging PHP or mod_perl. Your conversation resonates from keel to crowsnest of exactly the kind of tunnel-vision MoeDrippings mentions.
Would you care to give us a bit more context? Maybe a page or two on what you're actually trying to achieve, rather than just stating that specific features were absent (when they weren't) and then falling back on more bald statements that said features were inadequate. Something more convincing and complete?
Got time? Spend some of it coding or testing
...grail or not, Ruby is a lot holier than any other scripting language I've used. Unless you try to treat it like Java or PERL, in which case it comes across about as well as a CoBOL programmer writing in C.
Got time? Spend some of it coding or testing
http://www.stripcreator.com/comics/arbi/290818
Microsoft and many others have been doing similar things for over a decade, and for money.
If I had to change what they were saying, it would be to add one word, "already", to their spiel to flag its immaturity for the sake of the innocent.
However, the whole situation is pretty much like a simple ballistics comparison transmogrified into software: J2EE has been flying for a lot longer, so it's higher in the air now, but by sighting along the trajectories you can easily see that RoR has a clearly greater base velocity and will fly both higher and further than J2EE. If there are performance bottlenecks, they will be coded around, and probably in far shorter order than they were on Java's timeline. Java and other languages have been doing a certain amount of trailblazing there already, so Ruby can simply reimplement only the roundest and most resilient of software wheels and use them rather than having to laboriously reinvent them from scratch and try each one out.
Is that enough metaphor soup for one day?
Got time? Spend some of it coding or testing
No, the fundamental advantage of dynamic languages is programmer productivity. You can accomplish a goal in a dynamic language like Scheme, Smalltalk, Python, or Ruby in 100 lines that would require 500 or more lines of Java. That's also an advantage when you have to modify the code--there's less of it and it's faster and easier to read as a result. It's also much simpler and faster to create unit tests in dynamic languages, leading to more and faster testing of projects. These advantages grow with the size of the project.
The other advantage of dynamic languages is flexibility. While Java has limited support for features like reflection and generics, dynamic languages have offered much more powerful and easy to use versions of these features for years. Java is also missing other dynamic features like closures and metaprogramming. Groovy's feature list is an inverted list of many of the limitations in Java's dynamic capabilities.
Java's main contribution to programming languages isn't any new feature. It doesn't have any significant new features, and most of its main features like object orientation, byte-compilation/VM and primitive concurrency were in other languages like Simula and Pascal in the 1960s or 1970s. Java's primary contribution is that it was well marketed and that its limited dynamic features have inspired a large number of programmers to want more of the flexibility that languages like Scheme and Smalltalk offered decades ago.
...so I still have to use PHP4 for anything involving iMagick calls.
Yes, I know. I was just pushing your buttons. (-:
Got time? Spend some of it coding or testing
It's clear that you've not had exposure to any great languages yet. (-:
Got time? Spend some of it coding or testing
...but like PERL, it just happens to be a useful "smooshy mess".
PERL is generally more consistent than PHP. When you consider PHP's history, this is completely unsurprising. It went from a simple CGI templating thingy to a Swiss Army Complete Web Engineering Corps that also does command-line, interactive graphics (including 3D), Flash, PDF and all manner of other stuff.
Got time? Spend some of it coding or testing
...by the time it rolls off the presses, makes its way through warehouses and parcel post to your doorstep, RoR will have been substantially improved. (-:
Got time? Spend some of it coding or testing
...they switched away from FreeBSD.
Got time? Spend some of it coding or testing
Zope is a hog, but it's also very quick development environment - until you hit a wall and have to rebuild big slabs of the Zope universe more or less from scratch in order to handle a small extra feature. Modulo that and heaps of server horsepower, it's extremely attractive.
Got time? Spend some of it coding or testing
SoS ("Sack of Shit") is the name of the newly-designated replacement for RoR ("Ruby on Rails"). The former RoR designers felt that this more fully expressed the flaming fervor of their framework's proponents. "And we picked the next letter in the alphabet, 'S' follows 'R', just to show how much fun we're having."
JAXOFF ("JavaScript and XML Over Form Field validation) is the new highly-touted RoR successor to AJAX.
New websites in SoS/JAXOFF should begin appearing within the next 10 minutes, since development time is so short and "no code whatsoever is necessary to produce an SoS/JAXOFF application." said SoS developers.
Hey this is all well and good but do you honestly believe that I really wish to learn ruby? Python does a simply smashing job for me and so does PHP.
Call me lazy but rails is not that great that I am going to invest time in yet another scripting language.
Although ajax architecture is the big buzz word because of google maps it is still damn messy to deal with from a programming aspect.
Now I am not a guy big on flash but take a look at a project with some potential like Lazslo. Now that is a great innovative use of a ajax type architecture that has some fantastic capabilities. Hell I just seen a tv ad promoting a application written in it....Lazslo not that is a innovative open source product....and no I have never even developed a lazso app but it exceeds anything I have seen thus far.
Got Code?
Go read David's blog. He makes up completely and utterly false claims about rails vs java all the time, just to stir up shit with java people. Rails is not under any circumstances 10 times faster to develop in than any java framework, but that's the claim he's always making. In fact, having used both rails and RIFE, rails isn't actually faster to use at all, but David still makes misleading comparisons on his blog of best case rails examples vs worst case rife examples to make it seem like rails is 10 times faster to use.
If your sole criteria for "better" is "less keystrokes", then rails is better, and so is not commenting your code and using single letter variable names. If you instead consider things like time to develop, time to maintain, performance, scalability, security, reliability, etc, then you will realize that some java frameworks will be better for some things, and rails will be better for other things, and that there's plenty of other options in other languages that are perfectly viable too. Trying to pretend rails is simply "better" than everything is rediculous.
Keep in mind, rails "scales" by spawning processes, which is slow and uses lots of memory. It also means that if someone tried to actually run a big site on rails like the rails zealots falsly claim you can, then you would end up with literally THOUSANDS of connections to your database server. So much for scaling. How you can possibly claim that rails is universally better than anything java has is beyond me. Think for yourself for a change, maybe even go try a few java frameworks before you making such rediculous claims.
And again, "available to use" does matter. Because you are comparing a version of rails that only exists in your imagination, to a vague concept you don't understand (J2EE). Compare what rails has now, what is really there. And compare an actual framework in java, not a vague concept of stuffy "enterprise" java. Or did you not realize there's many different frameworks you can use in java, with different strengths and weaknesses, so you can pick the one that best suites what you are doing.