SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    First Timer With Ruby - 1 Simple Q

    Hello,

    I am starting my first ruby rails project and I am impressed with it. I am learning the basics of ruby and I can see why people enjoy it as a language. Now, here is what I want to know:

    Should I really bone up on ruby for a good few days (For instance, this weekend) and learn all I can about:

    Strings, vars, arrays, loops, etc

    or is Rails, the framework, so focused on using its own syntax/logic, that it's really not necessary? I just worry that if I learn ruby I might find that "rails wants to run with ruby but the syntax/logic is different with this framework". Will I be able to steam roll through rails development if I learn to 'master ruby' or is it going to be necessary to change a bit of what I learn if I want to use ruby language with the rails framework?

    Thanks.

  2. #2
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    I am starting my first ruby rails project and I am impressed with it. I am learning the basics of ruby and I can see why people enjoy it as a language. Now, here is what I want to know:

    Should I really bone up on ruby for a good few days (For instance, this weekend) and learn all I can about:

    Strings, vars, arrays, loops, etc

    or is Rails, the framework, so focused on using its own syntax/logic, that it's really not necessary?

    PS. Here is an example of what I mean.

    Ruby Original Code

    Code:
    @names.each do |name|
      puts "Hello #{name}!"
    end
    Do we use {name} to personalize any data in rails? I don't see such a litreal usage (yet, from my limited research) in rails ruby code. That's my concern, getting too familiar with syntax in original ruby and having to start over with Rails syntax (if there is a difference). Since my goal is 'web only' development, I just wondered if I should 'learn ruby' the way rails uses it. Since my goal is to focus only on online deployment, I wonder if I should just 'learn ruby' through rails and not bother using the command line to learn ruby?

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2010
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Definitely spend the weekend with Ruby. Everything you learn in Ruby will help with Rails, even the built-in HTTP methods in Ruby if you decide to access APIs.

    For your snippet, imagine if those names were retrieved from the database. You would use almost the same code to display them in a browser, except

    <%@names.each do |name|%>
    <li><%=name%></li>
    <%end%>

    or something like that.

    Don't spend months learning Ruby, but a weekend crash course will serve you well. Rails = Ruby + webapp skeleton code.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,147
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Rails is written in Ruby. So IMHO you should get comfortable with Ruby syntax.

    What Rails has, is what I call "conventions" as opposed to "syntax". But I think I know what you mean. To me learning Rails is additional on top of Ruby, not separate from it. So no, you won't have to un-learn any Ruby by learning Rails. And to learn Rails you will eventually need to learn Ruby. So I think it would be easier to learn Ruby first (at least enough basics to start playing).

  5. #5
    SitePoint Guru
    Join Date
    Mar 2002
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So basically, for conditionals and arrays/etc, I will be comfortable once I learn ruby. I just might have to tweak a few things (syntax) but nothing more. For instance, all syntax associated with puts will be similar to what I recall with ASP many years back. Ok, that sounds like a plan.

    I already feel comfortable with arrays, conditionals, methods/objects (basic uses) so I might as well just bone up for another day or two. After that, I'll spend the first week adapting to the logic behind the framework and take it from there.

    Thanks, guys.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •