So... "Ruby on Rails" is a web framework built on the programming language "Ruby". Ruby is a quick to learn, object oriented, scripting language. It boasts of high code efficiency and friendly maintainability. You might already be wondering, "So where's the studio, right?" Well, try Net Beans 6. Ruby support has been discontinued in NetBeans 7.0, and the studio is nothing compared to the sweet coolness of Visual Studio, so just forget about studios once you're decent at ruby -after all, it's just a script language, right? Switch to vim once you have some serious free time on your hands.
Now, Ruby is going to be slightly more complicated than other scripting languages you may have tried as that it is:
-OS independent (most of Ruby runs on windows/nix/Mac/Commodore 64)
-Comprehensively object oriented (nil is an object!)
-It looks like this sometimes Dir::mkdir(directory_name) (yuck! That just makes me want to get sick on my keyboard)
So, once you get over those speed bumps, you should probably just be good to go... But you need a reference...
For the language itself
Ruby Fundamentals
example:
That should be pretty easy to follow if you have some programming experience. The cool thing about ruby is that they give you a console which can be used to test code like this out on! $ irb or if you're on windows irb.exe.
Let's do the same bit of code, with a narly awesome ruby convention, that I want all languages to have someday. It's the ! punctuation. Watch!
Ok, so you can probably tell by now that ruby is going to be your new favorite scripting language. It actually moves a little bit faster than PHP too, so that should make you feel krad about things. Let's do some code all on the same line, cause that's an enjoyable thing to do with code when you're first starting out.
How fun. Now what...
For the Cool stuff you can do with the script
If only there was an ss64.com for ruby...
Well here's this site, but I gotta say, I am really not a fan... Maybe my first rails app will be an ss64 version of that site. Or maybe I'll just get used to it. idk.
So it would seem that ruby has modules that are in charge of doing specific things. For manipulating the file system, you would use fileutils, and if you wanted to do some crazy ftp stuff, you would use net::ftp. That's pretty cool I guess. For some reason I feel as though it's not "real" unless you compile. I've always gotten that feeling. But... let's just ignore that part of things and move on with our digital careers.
Conventions
http://onestepback.o...ngs/item10.html
Note the cases, and the underscores... I don't know why they want us using underscores, but I guess I'll conform to better fit in with the industry...
Now, Ruby is going to be slightly more complicated than other scripting languages you may have tried as that it is:
-OS independent (most of Ruby runs on windows/nix/Mac/Commodore 64)
-Comprehensively object oriented (nil is an object!)
-It looks like this sometimes Dir::mkdir(directory_name) (yuck! That just makes me want to get sick on my keyboard)
So, once you get over those speed bumps, you should probably just be good to go... But you need a reference...
For the language itself
Ruby Fundamentals
example:
h = ["h", "e", "l", "l", "o"] # this creates an array of objects. All objects happen to be chars
he = h.join(" ") # this joins the array into a single string. The result is he = "h e l l o"
hel = he.gsub(" ", "") # that 'replaces' those spaces with nothing. hel = "hello"
hell = hel.include?("hello") # if hel contains the string "hello" then return true. hell = true
hello = hel + " world" if hell # hello world
hello_leet = "Oh, #{hel} world"
That should be pretty easy to follow if you have some programming experience. The cool thing about ruby is that they give you a console which can be used to test code like this out on! $ irb or if you're on windows irb.exe.
Let's do the same bit of code, with a narly awesome ruby convention, that I want all languages to have someday. It's the ! punctuation. Watch!
h = ["h", "e", "l", "l", "o"] # h starts out as an array
h = h.join(" ") # now h is a string
h.gsub!(" ", "") # now, h = "hello" ! holy cow, that's like gsub, but different!
#
# Anything with the ! mark will actually change the data object it's being used on
# It doesn't work for [inline]join[/inline] for some reason... I think because join changes the object type
Ok, so you can probably tell by now that ruby is going to be your new favorite scripting language. It actually moves a little bit faster than PHP too, so that should make you feel krad about things. Let's do some code all on the same line, cause that's an enjoyable thing to do with code when you're first starting out.
h = ["h", "e", "l", "l", "o"].join(" ").gsub(" ", "").include?("hello")
hello = "hello world" if h
How fun. Now what...
For the Cool stuff you can do with the script
If only there was an ss64.com for ruby...
Well here's this site, but I gotta say, I am really not a fan... Maybe my first rails app will be an ss64 version of that site. Or maybe I'll just get used to it. idk.
So it would seem that ruby has modules that are in charge of doing specific things. For manipulating the file system, you would use fileutils, and if you wanted to do some crazy ftp stuff, you would use net::ftp. That's pretty cool I guess. For some reason I feel as though it's not "real" unless you compile. I've always gotten that feeling. But... let's just ignore that part of things and move on with our digital careers.
Conventions
http://onestepback.o...ngs/item10.html
Note the cases, and the underscores... I don't know why they want us using underscores, but I guess I'll conform to better fit in with the industry...
ClassNames
method_names and variable_names
methods_asking_a_question?
slightly_dangerous_methods!
@instance_variables
$global_variables
SOME_CONSTANTS or OtherConstants
0 Comments On This Entry
Trackbacks for this entry [ Trackback URL ]
Tags
My Blog Links
Recent Entries
-
-
Rails - Sending delete signals to rails with jQuery since it broke PROTOTYPE's delete links
on Feb 25 2012 08:56 AM
-
-
-
Recent Comments
-
NotarySojac
on Aug 03 2011 02:50 PM
005 Rails: From Views to Models -- The flow of data from the user
Search My Blog
0 user(s) viewing
0 Guests
0 member(s)
0 anonymous member(s)
0 member(s)
0 anonymous member(s)
Categories
|
|



Leave Comment








|