<?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>In a world where ninja&#039;s rule, i am Solar Sneeze Phantom &#187; Ruby on Rails</title>
	<atom:link href="http://www.marcosantos.com/archives/category/ruby-on-rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcosantos.com</link>
	<description>In a world where ninja&#039;s rule, i am Solar Sneeze Phantom</description>
	<lastBuildDate>Sun, 21 Feb 2010 09:59:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Ruby on Rails Quick Tip #1: Loading models in Rails 2.0</title>
		<link>http://www.marcosantos.com/archives/2009/03/22/ruby-on-rails-quick-tip-1-loading-models-in-rails-20/</link>
		<comments>http://www.marcosantos.com/archives/2009/03/22/ruby-on-rails-quick-tip-1-loading-models-in-rails-20/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 19:11:14 +0000</pubDate>
		<dc:creator>Marco</dc:creator>
				<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.marcosantos.com/?p=24</guid>
		<description><![CDATA[Here is a quick tip, that i have learned, this applied to the book Beginning Ruby on Rails chapter 7 (page 206), in the book we were [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.marcosantos.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/24.jpeg&amp;w=200&amp;h=150&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p>Here is a quick tip, that i have learned, this applied to the book Beginning Ruby on Rails chapter 7 (page 206), in the book we were asked to load models (please remember that the book was published when the rails being used was 1.2.X, around 2007.</p>
<pre name="code" class="ruby">
# Ruby on Rails - Quick Tip - Loading models in Ruby 2.X.X
# Book: Beginning Ruby on Rails Chapter 7 (page 206)
# Marco's notes: 2009.03.23

# We were asked to load models in the application controller 

  class ApplicationController < ActionController::Base
    model :cart
    model :purchases
  end

# Results in this:
# undefined method `model' for ApplicationController:Class

# This ofcourse won't work in Ruby 1.8.6 (universal-darwin9.0)
# and Rails version	2.3.2

# So we try this:

class ApplicationController < ActionController::Base

  require_dependency 'cart' # this solves the issue load :model
  require_dependency 'purchase' # this solves the issue load :model

end
</pre>
<p>By the way, for those who have this book, the official forum for it is: <a href="http://p2p.wrox.com/book-beginning-ruby-rails-289/">Beginning Ruby on Rails</a>.</p>
<p>Learn more about <a href="http://www.ruby-forum.com/topic/133260">require_dependency </a>.</p>
<p>I hope it was useful.</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.marcosantos.com/archives/2009/03/22/ruby-on-rails-quick-tip-1-loading-models-in-rails-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails: Scaffold before and after 2.0</title>
		<link>http://www.marcosantos.com/archives/2009/03/22/ruby-on-rails-scaffold-before-and-after-20/</link>
		<comments>http://www.marcosantos.com/archives/2009/03/22/ruby-on-rails-scaffold-before-and-after-20/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 18:30:43 +0000</pubDate>
		<dc:creator>Marco</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://www.marcosantos.com/?p=20</guid>
		<description><![CDATA[Here we are, i have spent quite some time figuring this out, hopefully google is our friend and patient as well, this example comes from doing the [...]]]></description>
			<content:encoded><![CDATA[<p><img src='http://www.marcosantos.com/wp-content/plugins/simple-post-thumbnails/timthumb.php?src=/wp-content/thumbnails/20.jpeg&amp;w=200&amp;h=150&amp;zc=1&amp;ft=jpg' alt='post thumbnail' /></p>
<p>Here we are, i have spent quite some time figuring this out, hopefully google is our friend and patient as well, this example comes from doing the excelent Beginning Ruby on Rails book from Wrox, chapter 6 page 167.</p>
<p>Please read the comments on the code:</p>
<pre name="code" class="ruby"># Ruby on Rails - Learnt by example, Scaffold issue old vs new
# Book: Beginning Ruby on Rails Chapter 6 (page 167)
# Marco's notes: 2009.03.23

# In step 2 - Create a model named Item and a controller named Manage ...
# Original code, as run by the Ruby 1.8.4 and Rails 1.2.1 (circa 2006)

 ruby script/generate scaffold Item Manage

# Results in this:   wrong number of arguments (1 for 2)
# Topic available here:
# http://groups.google.com/group/bangalorerug/browse_thread/thread/c08b0dccd17f06d1

# This ofcourse won't work in Ruby 1.8.6 (universal-darwin9.0)
# and Rails version	2.3.2

# So we try this:

# ruby script/generate scaffold model field:fieldType ...
 ruby script/generate scaffold Item name:string description:text price:float

# This solves the issue in page 167, but remember that now your controller will be
# items, not manage, so in the example would be http://localhost:3000/items
</pre>
<p>See, there you go, remember that after doing this, in your chapter 6, you won&#8217;t access your scaffold result by going to http://localhost:3000/manage but http://localhost:3000/items.</p>
<p>Beginning Ruby on Rails &#8211; Chapter 6 <a href="http://p2p.wrox.com/book-beginning-ruby-rails/67442-chapter-6-scaffold-error-wrong-number-args.html">Wrong number of arguments</a>.</p>
<p>Also a nice tutorial, although a bit long is: <a href="http://fairleads.blogspot.com/2007/12/rails-20-and-scaffolding-step-by-step.html">Rails 2.0 step by step</a>.</p>
<p>Hope this has helped.</p>
<!-- PHP 5.x -->]]></content:encoded>
			<wfw:commentRss>http://www.marcosantos.com/archives/2009/03/22/ruby-on-rails-scaffold-before-and-after-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
