background preloader

Ruby

Facebook Twitter

Getting Started with Rails. 1 Guide Assumptions This guide is designed for beginners who want to get started with a Rails application from scratch.

Getting Started with Rails

It does not assume that you have any prior experience with Rails. Rails is a web application framework running on the Ruby programming language. If you have no prior experience with Ruby, you will find a very steep learning curve diving straight into Rails. There are several curated lists of online resources for learning Ruby: Be aware that some resources, while still excellent, cover versions of Ruby as old as 1.6, and commonly 1.8, and will not include some syntax that you will see in day-to-day development with Rails. 2 What is Rails?

Rails is a web application development framework written in the Ruby programming language. Rails is opinionated software. The Rails philosophy includes two major guiding principles: 3 Creating a New Rails Project The best way to read this guide is to follow it step by step. 3.1 Installing Rails Open up a command line prompt. 4 Hello, Rails! Installing Ruby, RubyGems, and Rails on Snow Leopard. Monday, 31 August 2009 • Permalink These are instructions for compiling and installing 64-bit Ruby, Rubygems, and Ruby on Rails on Mac OS X 10.6, Snow Leopard.

Installing Ruby, RubyGems, and Rails on Snow Leopard

The benefits of manually building a copy of Ruby in /usr/local are detailed here and here. Prerequisites Before following these instructions, you will need: Mac OS X 10.6 Snow Leopard The latest Xcode Tools (from the Snow Leopard DVD or downloaded from Apple — the 10.5 version won’t work) Confidence running UNIX commands using the Terminal If you want to learn more about UNIX and the command line, check out my PeepCode screencast on this topic. Step 1: Set the PATH Launch Terminal.app from the /Applications/Utilities folder. The first thing we’ll do is set your shell’s PATH variable. If you’re using TextMate like you should be and have installed the UNIX mate command, then you can create and start editing the file like this: mate ~/.profile To the end of this file, add the following line: source ~/.profile echo $PATH Step 2: Download.

Variables and Assignments. To store a number or a string in your computer's memory for use later in your program, you need to give the number or string a name. Programmers often refer to this process as and they call the names . A variable springs into existence as soon as the interpreter sees an assignment to that variable. s = 'Hello World! ' x = 10 s = 'Hello World! ' A is any combination of letters, numbers, and underscores, and is not qualified by any symbols ( : ). Can also be barewords, such as my_method.

The shows us some more usage with strings. puts PI my_string = 'I love my city, Pune' puts my_string = begin Conversions .to_i, .to_f, .to_s = end var1 = 5; var2 = '2' puts var1 + var2.to_i a = 'hello ' a<< 'world. I love this world...' puts a << marks the start of the string literal and is followed by a delimiter of your choice. The string literal then starts from the next new line and finishes when the delimiter is repeated again on a line on its own. Here document syntax. a = <<END_STR This is the string And a second line. Try ruby! (in your browser) Ruby Programming for the Absolute Beginner: Safari Books Online - Premium.