#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2008
    Posts
    6
    Rep Power
    0

    Question Ruby Pro - Can someone explain some stuff please?


    I am interested to know what BaseCampHQ.com uses for their programming? From what I have read, this is a type of Ruby on Rails that allows dynamic functionality on the page without reloading such as:

    -Creating new task lists and tasks
    -Reorganizing tasks dynamically by dragging without the page reloading
    -and additional advanced functionalities.

    My question is, If I want to create something that would allow functionality similar to this would I need to use Ruby on Rails specifically? Or could Ajax/Javascript also output the same functionality?

    Can someone explain the benefits and all?
    Last edited by Vision4all; August 13th, 2008 at 03:01 AM. Reason: forgot a letter in Ruby in title
  2. #2
  3. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    All those bells and whistles that you see on that page are done with Ajax (basically lots of javascript) and some back-end code. While you could do the same thing with other languages as well, Ruby on Rails just makes it easier to create pages like that. Why?? Because you don't need to write most of the javascript code to support all that functionality, since it already comes with rails and is well integrated with it.

    For instance, if I want to make a drop-down box that auto-populates when a user is typing in it, all I need to do is write something like this in the template file (here we're assuming I have a table called categories and a field called short_desc from which we should auto-populate as the user is typing):
    Code:
    <%= javascript_include_tag :defaults %>
    <%= text_field_with_auto_complete :category, :short_desc %>
    and in my controller file
    Code:
    auto_complete_for :category, :short_desc
    When this code is run through ruby on rails, it generates all the HTML for me. The first line will be replaced with a bunch of <script src="..."> lines which include a bunch of prewritten javascript code that we need for the magic to happen, the second line (the text_field_with_auto_complete) will be replaced with HTML to show a text box, as well as a bunch of code to send messages to the server to update the field when the user is typing, as well as code to show a drop-down with the possible completions. The third line will generate all the code I need in the back-end to send suggested responses back to the user as they're typing.

    So instead of typing out a bunch of front-end and back-end code to do this, like I would have to do in other languages, I just need to type 3 lines in my code and let ruby on rails generate all the code for me automatically. It may not be the most efficient way to do it, but it is fast enough and my development time for this feature is all of 1 minute at most.
    Last edited by Scorpions4ever; August 14th, 2008 at 12:18 AM.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2008
    Posts
    6
    Rep Power
    0
    Originally Posted by Scorpions4ever
    All those bells and whistles that you see on that page are done with Ajax (basically lots of javascript) and some back-end code. While you could do the same thing with other languages as well, Ruby on Rails just makes it easier to create pages like that. Why?? Because you don't need to write most of the javascript code to support all that functionality, since it already comes with rails and is well integrated with it.
    Now THAT was a great response and exactly what I was looking for to understand.

    So my next question is, if I were to want to have something created where I am allowing tasks to be moved around on a page, would this be something that I should be considering Ruby on Rails for? Or would I be better off using an Ajax and jquery?

    Scorpions4ever, are you available for programming or consulting, or for knowledge? I would like to find a programmer that I can refer to for knowledge and/or possible programming.
  6. #4
  7. Banned ;)
    Devshed Supreme Being (6500+ posts)

    Join Date
    Nov 2001
    Location
    Woodland Hills, Los Angeles County, California, USA
    Posts
    9,607
    Rep Power
    4247
    Ajax is really glorified Javascript and runs on the client end. The problem is that with other frameworks, you may need to write all that javascript yourself. Ask yourself if you want to do all this and then determine if you want to learn Ruby and Ruby on Rails, or stick with what you know best.
    Up the Irons
    What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
    "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
    Down with Sharon Osbourne

    "I wouldn't hire a butcher to fix my car. I also wouldn't hire a marketing firm to build my website." - Nilpo

IMN logo majestic logo threadwatch logo seochat tools logo