<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Easy Ruby On Rails Programming &#187; Avatar</title>
	<atom:link href="http://easyrubyonrailsprogramming.com/author/avatar/feed/" rel="self" type="application/rss+xml" />
	<link>http://easyrubyonrailsprogramming.com</link>
	<description>The Place to be to Learn Ruby On Rails</description>
	<lastBuildDate>Sat, 24 Dec 2011 05:30:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>The &#8216;yield&#8217; statement</title>
		<link>http://easyrubyonrailsprogramming.com/development/the-yield-statement/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/the-yield-statement/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 10:17:46 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sample Code]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/the-yield-statement/</guid>
		<description><![CDATA[It might be almost similar but relatively different in a big way for blocks may appear only in the source adjacent to a method call which means it should be written on the same line as the method&#8217;s last parameter and it is not implemented once it is encountered but, Ruby rather remembers the context [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.protsyk.com/cms/%3Fp%3D147"><img src="/wp-content/uploads/scraped/23.jpg"/></a>
<p>It might be almost similar but relatively different in a big way for blocks may appear only in the source adjacent to a method call which means it should be written on the same line as the method&#8217;s last parameter and it is not implemented once it is encountered but, Ruby rather remembers the context by which the block of code appears then enters the method. Within the method itself, the block of code may be called as if it were a block in itself by using the &#8216;yield&#8217; statement. After the block of code has been executed, control returns immediately right after the call to the yield statement. Sample use of &#8216;yield&#8217;:</p>
<p>def threeTimes<br />
     yield<br />
     yield<br />
     yield<br />
end<br />
threeTimes {puts &#8220;Hi There&#8221;}</p>
<p>The above code giving the output:<br />
Hi There<br />
Hi There<br />
Hi There</p>
<p>The code between the curly braces is associated to the method threeTimes and within that &#8216;yield is called three times in succession, each time calling the code contained within the block giving the three greeting statements. We will discuss the concepts behind the &#8216;yield&#8217; statement in the next posts as we continue to build-up up our skills.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/the-yield-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The &#8216;if&#8217; Statement</title>
		<link>http://easyrubyonrailsprogramming.com/development/the-if-statement/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/the-if-statement/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 10:15:40 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sample Code]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/the-if-statement/</guid>
		<description><![CDATA[As stated in the past post, we aim to simplify further the code we have just created with the following shorter version of the same program. class BookList def [](key) if key.kind_of?(integer) result = @Books[key] else result = @Books.find { &#124;aBooks&#124; key == sBooks.name} end return result end end Further shortening the code we have [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.ondotnet.com/pub/a/dotnet/2005/04/18/liberty.html%3Fpage%3D2"><img src="/wp-content/uploads/scraped/22.jpg"/></a>
<p>As stated in the past post, we aim to simplify further the code we have just created with the following shorter version of the same program.</p>
<p>class BookList<br />
     def [](key)<br />
	if key.kind_of?(integer)<br />
	     result =  @Books[key]<br />
	else<br />
	     result = @Books.find { |aBooks| key == sBooks.name}<br />
     	end<br />
	return result<br />
     end<br />
end</p>
<p>Further shortening the code we have above by using the ‘if’ statement as a modifier it becomes a shorter version of its former self as:</p>
<p>class Booklist<br />
     def [](key)<br />
	return @Books[key] if key.kind_of?(Integer)<br />
	return @Books.find { |aBooks| aBooks.name == key }<br />
     end<br />
end</p>
<p>The use of the &#8216;find&#8217; command in Ruby is simply a call to a function that is executed and it can be compared to a block call in many other languages such as Perl, C++ or Java. </p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/the-if-statement/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The [] method</title>
		<link>http://easyrubyonrailsprogramming.com/development/the-method/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/the-method/#comments</comments>
		<pubDate>Sun, 10 Oct 2010 10:11:15 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sample Code]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/the-method/</guid>
		<description><![CDATA[We now go through a process which implements the code on the [] method we just showed where we will take a string, searches for the book with the same title. The method would go through the whole table one at a time to get a match as shown with the following: class BookList def [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mines.edu/~jamcneil/"><img src="/wp-content/uploads/scraped/21.jpg"/></a>
<p>We now go through a process which implements the code on the [] method we just showed where we will take a string, searches for the book with the same title. The method would go through the whole table one at a time to get a match as shown with the following:</p>
<p>class BookList<br />
     def [](key)<br />
	if key.kind_of?(integer)<br />
	     return @Books[key]<br />
	else<br />
	     for C in 0&#8230;@Books.length<br />
		return @Books[i] if key == @Book[i].name<br />
	     end<br />
	end<br />
	return nil<br />
     end<br />
end</p>
<p>The above method is a bit too close for comfort for it asks the array which one is a match and does so while going through each and every member of the list. The find method shown below is faster and easier and more natural to do this by simply using the find command shown in the next post.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/the-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RoR Naming Conventions</title>
		<link>http://easyrubyonrailsprogramming.com/development/ror-naming-conventions/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/ror-naming-conventions/#comments</comments>
		<pubDate>Fri, 10 Sep 2010 19:51:42 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Naming Conventions]]></category>
		<category><![CDATA[Variable Names]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/ror-naming-conventions/</guid>
		<description><![CDATA[Some more basics or building blocks to better understand ruby, one of which is the naming convention used by the language. The first characters of a name shows how that specific name was used. Local variables, method names and method Parameters always start with either lowercase characters or an underscore. Global variables should always be [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.emadibrahim.com/2008/04/25/ruby-on-rails-for-a-net-developer/"><img src="/wp-content/uploads/scraped/14.jpg"/></a>
<p>Some more basics or building blocks to better understand ruby, one of  which is the naming convention used by the language. The first characters of a name shows how that specific name was used. Local variables, method names and method Parameters always start with either lowercase characters or an underscore. Global variables should always be prefixed with the <strong>&#8220;$&#8221;</strong> whilst instance variables with an at (&#8220;<strong>@</strong>&#8220;) sign. Class Variables use two &#8220;@@&#8221; with class names, module names and constants starting with uppercase letters. In the next post we will discuss arrays and hashes which are simply tables that use keys to access or point to a specific variable in that said table.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/ror-naming-conventions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simplifying the code</title>
		<link>http://easyrubyonrailsprogramming.com/development/simplifying-the-code/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/simplifying-the-code/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 10:07:05 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sample Code]]></category>
		<category><![CDATA[Simplifying code]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/uncategorized/simplifying-the-code/</guid>
		<description><![CDATA[We now check if the book titles are deleted from the first and end of the list which should give us &#8216;nil&#8217; when and if the list becomes void of contents. list.deleteFirst >> Books: ABDC&#8211;Author1 (1) list.deleteFirst >> Books: EFGH&#8211;Author2 (2) list.deleteLast >> Books: MNOP&#8211;Author1 (1) list.deleteLast >> Books: IJKL&#8211;Author3 (3) list.deleteLast >> nil We [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.statomatic.com/features3.htm"><img src="/wp-content/uploads/scraped/20.jpg"/></a>
<p>We now check if the book titles are deleted from the first and end of the list which should give us &#8216;nil&#8217; when and if the list becomes void of contents.</p>
<p>list.deleteFirst 	>> Books: ABDC&#8211;Author1 (1)<br />
list.deleteFirst	>> Books: EFGH&#8211;Author2 (2)<br />
list.deleteLast	>> Books: MNOP&#8211;Author1 (1)<br />
list.deleteLast	>> Books: IJKL&#8211;Author3 (3)<br />
list.deleteLast	>> nil</p>
<p>We now include the use of the square brackets which allows us to acces the specific elements by the index instead of having to define each item specifically.</p>
<p>class BookList<br />
	def[](key)<br />
		if key.kind_of?(Integer)<br />
			@Books[key]<br />
		else<br />
			# &#8230;<br />
		end<br />
	end<br />
end</p>
<p>Testing the code is also very straightforward:</p>
<p>list[0]		>> Books: ABCD &#8212; Author1 (1)<br />
list[2]		>> Books: IJKL &#8212; Author  (3)<br />
list[9]		>> nil	</p>
<p>The next posts will add more functions and operators to further simplify our code making it shorter and making you more familiar with the syntax of Ruby.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/simplifying-the-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Append</title>
		<link>http://easyrubyonrailsprogramming.com/development/append/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/append/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 10:02:53 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Sample Code]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/append/</guid>
		<description><![CDATA[Using the append command/method, we can add an element to the end of the table which in turn returns a reference to the current BookList object.The deleteFirst and deleteLast command allows us to delete the first and last records respectively in the following form/s: For Append: class BookList def append(aBook) @books.push(aBook) self end end For [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.main.nc.us/openstudio/tinamanley/Iraq/append.htm"><img src="/wp-content/uploads/scraped/19.jpg"/></a>
<p>Using the append command/method, we can add an element to the end of the table which in turn returns a reference to the current BookList object.The deleteFirst and deleteLast command allows us to delete the first and last records respectively in the following form/s:</p>
<p>For Append:<br />
class BookList<br />
	def append(aBook)<br />
		@books.push(aBook)<br />
		self<br />
	end<br />
end</p>
<p>For deleteFirst and deleteLast</p>
<p>class BookList<br />
	def deleteFirts<br />
		@books.shift<br />
	end<br />
	def deleteLast<br />
		@books.pop<br />
	end<br />
end</p>
<p>Now we test the code we have just created to show if the right operations are being performed and if we are getting the results we desire:</p>
<p>list = BookList.new<br />
list.<br />
	append(Books.new(&#8216;ABCD&#8217;, &#8216;Author1&#8242;,1)).<br />
	append(Books.new(&#8216;EFGH&#8217;, &#8216;Author2&#8242;,2)).<br />
	append(Books.new(&#8216;IJKL&#8217;, &#8216;Author3&#8242;,3)).<br />
	append(Books.new(&#8216;MNOP&#8217;, &#8216;Author4&#8242;,4))</p>
<p>In the next posts, we get to check and simplify the code we have just executed.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/append/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Empty arrays and Shortcuts</title>
		<link>http://easyrubyonrailsprogramming.com/development/empty-arrays-and-shortcuts/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/empty-arrays-and-shortcuts/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 20:23:07 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Array Creation Shortcut]]></category>
		<category><![CDATA[Hashes]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/empty-arrays-and-shortcuts/</guid>
		<description><![CDATA[In the last post, we created arrays and showed how the various elements could be accessed or the contents changed. Now, we will create empty arrays which would be useful for easy tracing of code when you start building whole projects. To create an empty array with no elements or by using the array object&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://courses.ece.uiuc.edu/ece463/SP08/labs/LVtraining/LVtutorial.htm"><img src="/wp-content/uploads/scraped/16.jpg"/></a>
<p>In the last post, we created arrays and showed how the various elements could be accessed or the contents changed. Now, we will create empty arrays which would be useful for easy tracing of code when you start building whole projects. To create an empty array with no elements or by using the array object&#8217;s <strong><a href="http://www.ruby-doc.org/docs/ProgrammingRuby/">constructor</a></strong> ( a detailed discussion on constructors is available in the link). Sample empty array creation, &#8221; empty1=[] empty 2 = Array.new &#8220;. To shorten the process of creating arrays there is the %w it&#8217;s use is shown below.</p>
<p>z =  %w {Honda Toyota Mazda Ford Chevrolet Mercedes}<br />
z=[3]		>>		&#8220;Mazda&#8221;<br />
z=[6}		>>		&#8220;Mercedes&#8221;</p>
<p>In the next post, we will turn to hashes which is also a form of table.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/empty-arrays-and-shortcuts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RoR Arrays and Hashes</title>
		<link>http://easyrubyonrailsprogramming.com/development/ror-arrays-and-hashes/</link>
		<comments>http://easyrubyonrailsprogramming.com/development/ror-arrays-and-hashes/#comments</comments>
		<pubDate>Mon, 10 May 2010 20:22:12 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Arrays]]></category>
		<category><![CDATA[Hashes]]></category>
		<category><![CDATA[Variable Naming Conventions]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/development/ror-arrays-and-hashes/</guid>
		<description><![CDATA[An array is a table or indexed collection that needs an integer key to point to a specific set of information contained within the said table. A hash on the other hand, supports any object as a key meaning it can be numeric, character or alphanumeric to name some. To initiate a new array you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://sumanthtechsavvy.blogspot.com/2007/12/ruby-on-rails-learning-through-examples.html"><img src="/wp-content/uploads/scraped/15.jpg"/></a>
<p>An array is a table or indexed collection that needs an integer key to point to a specific set of information contained within the said table. A hash on the other hand, supports any object as a key meaning it can be numeric, character or alphanumeric to name some. To initiate a new array you need to use a new array literal which is a set of elements contained between two square brackets (&#8220;[ ]&#8220;) an example of which is shown below.</p>
<p>b = [5, 'mouse', 'deer', 2.54] # array with four elements<br />
# to access the first element (array content)<br />
b[0]  >gives you the value or content of position 0 > 1<br />
# to change the contents of the fourth element<br />
b[4] = nil<br />
# to show all the contents of the array<br />
b     >>		[5, 'mouse', 'deer', nil]</p>
<p>Arrays and hashes grow exponentially to house elements that are to be contained within them. In the next posts we would create empty arrays and show a shortcut to the array creation syntax.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/development/ror-arrays-and-hashes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back to Basics</title>
		<link>http://easyrubyonrailsprogramming.com/programming-language/back-to-basics/</link>
		<comments>http://easyrubyonrailsprogramming.com/programming-language/back-to-basics/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 09:35:32 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Programming Language]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/programming-language/back-to-basics/</guid>
		<description><![CDATA[Now, for those who do not have any idea what we are doing as of now, better begin again from the start. The term &#8220;Easy to Learn&#8221; doesn&#8217;t mean that you get all the stuff into your head in a couple of minutes. While it is true that there are several claims of getting you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://funkysouls.com/2/3316_1.html"><img src="/wp-content/uploads/scraped/13.jpg"/></a>
<p>Now, for those who do not have any idea what we are doing as of now, better begin again from the start. The term <strong>&#8220;Easy to Learn&#8221;</strong> doesn&#8217;t mean that you get all the stuff into your head in a couple of minutes. While it is true that there are several claims of getting you to program in as little as 15 minutes with their guides, there is truly more to the said programming stuff such as lingo and naming conventions that are used in programming. Now assuming you do not know anything, anything at all about programming try reading through several resources such as <strong><a href="http://www.ruby-doc.org/docs/ProgrammingRuby/">&#8220;The Pragmatic Programming Guide for Ruby on Rails&#8221;</a></strong> from Ruby Org and many other resources that offer the basics from the beginning.</p>
<p>True programming goes with the learning curve of making and discovering why mistakes were made and correcting them. Being object oriented, all declarations and almost all of the stuff you make with Ruby on Rails is going to become an object which makes it easy to understand and troubleshoot. Learning to program is a step by step process and our aim is to get you slowly and pointed in the right direction.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/programming-language/back-to-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started</title>
		<link>http://easyrubyonrailsprogramming.com/programming-language/getting-started/</link>
		<comments>http://easyrubyonrailsprogramming.com/programming-language/getting-started/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 07:16:47 +0000</pubDate>
		<dc:creator>Avatar</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Programming Basics]]></category>
		<category><![CDATA[Programming Language]]></category>
		<category><![CDATA[Learning RoR]]></category>
		<category><![CDATA[Programming Concepts]]></category>
		<category><![CDATA[RoR]]></category>

		<guid isPermaLink="false">http://easyrubyonrailsprogramming.com/programming-language/%post-name%/</guid>
		<description><![CDATA[Ruby on rails can be downloaded from many sources over the internet like from http://api.rubyonrails.org/ where there are also instructions on how to quickly install and start programming. The first lessons would be the forever basic &#8220;Hello World&#8221; program which is very easy if you get set-up right. For a more automated installation you could [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://store.attributes.com.sg/default.php%3FcPath%3D50"><img src="/wp-content/uploads/scraped/11.jpg"/></a>
<p>Ruby on rails can be downloaded from many sources over the internet like from http://api.rubyonrails.org/ where there are also instructions on how to quickly install and start programming. The first lessons would be the forever basic &#8220;Hello World&#8221; program which is very easy if you get set-up right. For a more automated installation you could also check-out Instant Rails or Locomotive for users on the Mac platform.<br />
An example of the shortest way to get from installation to your first application would be;<br />
alias rails_hello_world=&#8217;rails hello &#038;&#038; cd hello &#038;&#038; ./script/generate controller welcome hello &#038;&#038; echo &#8220;Hello World&#8221; > app/views/welcome/hello.rhtml &#038;&#038; ./script/server -d &#038;&#038; firefox 0.0.0.0:3000/welcome/hello&#8217;. The <strong><a href="http://wiki.rubyonrails.com/rails/pages/Tutorial">code</a></strong> was compliments of ReinH. In the following posts we would start with the declarations and other basic stuff that will get us on the right track to making more complicated procedures.</p>
]]></content:encoded>
			<wfw:commentRss>http://easyrubyonrailsprogramming.com/programming-language/getting-started/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

