Forgot your password?
typodupeerror
Programming IT Technology

Ajax On Rails 235

Posted by CmdrTaco
from the can-you-hack-it dept.
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."
This discussion has been archived. No new comments can be posted.

Ajax On Rails

Comments Filter:
  • by gavri (663286) on Saturday June 11, 2005 @09:43AM (#12788651) Homepage
    Get the Beta book http://pragmaticprogrammer.com/titles/rails/index. html [pragmaticprogrammer.com] If you're interested in Rails at all, this book is all you need.
  • AJAX meme (Score:3, Informative)

    by broward (416376) <browardhorne@gma ... m minus language> on Saturday June 11, 2005 @09:53AM (#12788681) Homepage
    The rise in AJAX is almost solely due to the recent AdaptivePath article. I'm not sure it's a major trend.

    http://www.realmeme.com/miner/technology/ajaxDejan ews.png [realmeme.com]

    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/hibernate vsrubyDejanews.png [realmeme.com]
  • by Buzzard2501 (834714) on Saturday June 11, 2005 @10:09AM (#12788732)
    AFAIK, Google doesn't use the XMLHttpRequest for any of their applications.

    Google Suggest uses XMLHttpRequest, while Google Maps uses a iframe
  • Re:Dont Forget Zope (Score:1, Informative)

    by Anonymous Coward on Saturday June 11, 2005 @10:11AM (#12788741)
    It's also an extremely heavy-weight platform, especially if all you're looking to do is simple web applications. In addition, running it alongside Apache is a bit of a resource hog.

    I'm not saying it's bad, but Rails and Zope are two completely different things. Comparing CGI to something that has its own built-in relational database, FTP server, et. al. doesn't make much sense.
  • Re:AJAX meme (Score:4, Informative)

    by shashark (836922) on Saturday June 11, 2005 @10:19AM (#12788776)
    From http://en.wikipedia.org/wiki/AJAX [wikipedia.org]

    There have been some critics of the term AJAX, claiming that the Adaptive Path [wikipedia.org] consultancy who created it [com.com] are using it as a marketing vehicle (and as a meme [wikipedia.org]) for previously used techniques [25hoursaday.com]

    It has been pointed out that the AJAX technologies did not have a common name before, and that some welcome a unifying term for the process. However it is also reported that the Google engineers who have created the most prominent applications using this technique consider their technologies as 'Javascript'

    AJAX is not a new approach of building software. From a higher perspective the presentation layer is like a form and a programming layer behind handling the events, commonly known in programming terms as MVC [wikipedia.org]. This kind of programming is very well known in older programming environments like Delphi, MFC, Visual Basic, Oracle ADF, and Windows Forms, just to name a few. Applications using this model of programming have been around for years: Microsoft Outlook Web Access using WebDAV and the Web based ERP system P2plus using web services directly from the browser. However, because there are no standards available for the communication model behind previous implementations, all use proprietary extensions.

    A new aspect to AJAX is that there are now multiple browsers that can be used to realize this type of application, as opposed to earlier technologies which were frequently limited only to Microsoft's [wikipedia.org] Internet Explorer [wikipedia.org].

  • by Anonymous Coward on Saturday June 11, 2005 @10:21AM (#12788782)
    AFAIK, Google doesn't use the XMLHttpRequest for any of their applications.

    Well, you don't know very much, do you?

    http://maps.google.com/mapfiles/maps.keyhole.6.saf ari.js
    // Copyright 2005 Google function Oa(){} Oa.create=function(){if(typeof ActiveXObject!="undefined"){try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(a){}}if(t ypeof XMLHttpRequest!="undefined"){return new XMLHttpRequest()}return null} ;function Aa(){}
    http://www.scss.com.au/family/andrew/opera/gmail/
    When Google introduced Gmail on 2004-04-01, they did not initially support Opera. The main sticking point was Opera's lack of XMLHttpRequest support.
  • by mav[LAG] (31387) on Saturday June 11, 2005 @10:21AM (#12788783)
    Agreed 100%. I bought it last week. Don't be fooled by its "beta" status - it's a thoroughly well written introduction to Rails that takes you through everything you need to know - including building a REAL application (a shopping cart) from start to finish.

    I also bought Programming Ruby by the same author because I want to do more with Ruby than just Rails, but this isn't necessary for those who just need Rails - all Ruby constructs and idioms are cross-referenced with an included introduction to the language.
  • by sucresemoule123 (462966) on Saturday June 11, 2005 @10:43AM (#12788852) Homepage
    RoR has caching : here [rubyonrails.com] and supports transactions : here [rubyonrails.com]
  • Get the book (Score:4, Informative)

    by Ridgelift (228977) on Saturday June 11, 2005 @10:46AM (#12788865)
    I first heard of Ruby on Rails here on Slashdot [slashdot.org]. 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" [pragmaticprogrammer.com]. The author of Ruby on Rails itself, David Heinemeier Hansson, is also a co-author. Great book, absolutely fantastic web development framework.
  • by zorander (85178) on Saturday June 11, 2005 @11:42AM (#12789045) Homepage Journal
    Enterprise software is a different game. Rails is pretty all around terrible at integrating with non-rails-intended database schemas which are plentiful in any enterprise situation.

    I'm going to overlook the fact that a flexible caching mechanism has been in place since pre-snowdevil (maybe february) and transaction support was added at some point before the last time I worked with rails (late april). Keep in mind that it's still pre-1.0 and beta and not yet feature-complete. Criticizing it for a lack of features it supports, though, is in poor taste.

    Furthermore, almost all rails development at this point has been executed using very small (5 people) core teams. J2EE supports large scale development because it was designed for it. Rails was designed to let a relatively small number of people write an agile application using the set of paradigms which rails was built on. Coming at it from an "I use java in the enterprise and couldn't plug rails in its place tomorrow" is a little bit unfair, because in the same sense, I couldn't just drop J2EE onto my own desktop and start developing with it tomorrow. (Not to mention that my boss would not even begin to authorize such an expenditure for one developer on one product).

    I see rails more as a contender to PHP than to J2EE. J2EE and rails are not really comparable in the same market. Sure, rails beats the crap out of J2EE when you've got 1-3 developers on the project, and inversely, when there's more than 10, J2EE has a clear advantage. Coming from java, you're likely to miss many of the benefits of metaprogramming in rails. Even coming from python (a somewhat similar language to ruby), I was a bit startled at some of the techniques being used.

    Your project might have failed, but I'm not sure it was completely rails that caused it. AR is very easily extensible (in a matter of hours, usually) to do all sorts of more enterprise-java-like things. Ruby's dynamic messaging and open classes makes that a much simpler affair than it would be in java. Why didn't you extend it to meet your needs? Also, how did you miss the fact that caching and transactions have been there for a while? Were you trying to shoehorn rails onto an old schema? Did you have prior ruby programming experience or were you learning as you went? Did you have prior experience in a dynamically typed language writing an app of similar complexity? Nothing is going to make the solution of a hard problem easy. Some things can make it more pleasant, if used correctly.
  • by mixonic (186166) on Saturday June 11, 2005 @12:00PM (#12789104) Homepage
    > Ruby is easier.

    yes

    > Until you try to do something even moderately complex.

    nothing is easy when it's complex

    > caching

    nope, its there

    > transaction support

    yep it's weak.

    > object-relational mapping is inferior

    Isn't any OR mapper slow/bloated and really just a starting point?

    > RoR is nice

    yes :)

    > but it needs lots of polishing and some redesign.

    it's not 1.0 yet

    > In its present state RoR can't be compared with J2EE solutions, they are far more powerfull and _flexible_.

    I don't code Java professionally, so I don't know. But Rails ain't 1.0 yet. Check back in 3 months ;-)
  • by milesegan (134096) on Saturday June 11, 2005 @12:51PM (#12789347) Homepage
    Rails supports optimisting locking out of the box. Just add a lock_version column to your table and it will do the rest.
  • ASP.Net 2.0 (Score:3, Informative)

    by DigitlDud (443365) on Saturday June 11, 2005 @01:03PM (#12789419)
    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.
    http://www.developer.com/net/asp/article.php/35068 96 [developer.com]
  • by matchboy (519044) on Saturday June 11, 2005 @01:14PM (#12789488) Homepage
    That's the default Rails error page. Wasn't keeping up with the /. load with the default settings. Try again now.
  • by Some Random Username (873177) on Saturday June 11, 2005 @03:13PM (#12790098) Journal
    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.

When you don't know what to do, walk fast and look worried.

Working...