<?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>Improbabilidade Infinita &#187; ruby</title>
	<atom:link href="http://cgweb.com.br/blog/category/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://cgweb.com.br/blog</link>
	<description>Pois a vida é uma caixinha de surpresas.</description>
	<lastBuildDate>Fri, 19 Nov 2010 13:39:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Bowline + ActiveRecord</title>
		<link>http://cgweb.com.br/blog/2009/08/bowline-activerecord/</link>
		<comments>http://cgweb.com.br/blog/2009/08/bowline-activerecord/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 20:54:09 +0000</pubDate>
		<dc:creator>filipe</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://cgweb.com.br/blog/?p=14</guid>
		<description><![CDATA[A few days ago, maccman released Bowline, which, in his words &#8220;lets you build cross platform desktop applications with Ruby, HTML and JavaScript&#8221;. I&#8217;ve been playing around with at for the last couple of days, and although it has a lot yet to improve, it&#8217;s the most friendly desktop application framework I&#8217;ve seen. Anyway, it [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago, <a href="http://github.com/maccman" target="blank">maccman</a> <a href="http://leadthinking.com/191-bowline-a-ruby-gui-framework" target="blank">released Bowline</a>, which, in his words &#8220;lets you build cross platform desktop applications with Ruby, HTML and JavaScript&#8221;.<br />
I&#8217;ve been playing around with at for the last couple of days, and although it has a lot yet to improve, it&#8217;s the most friendly desktop application framework I&#8217;ve seen.</p>
<p>Anyway, it has been discussed a lot about the framework itself. I just posted here to help a few of those who couldn&#8217;t get ActiveRecord models to work properly.<br />
At least at my Mac, ActiveSupport raises an error when I created ActiveRecord models, as shown bellow:</p>
<pre>
[19:37:48:497] [Titanium.Ruby] [Error] An error occured while parsing Ruby on the page: /Library/Ruby/Gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:443:in `load_missing_constant': uninitialized constant ActiveRecord
</pre>
<p>Which means that ActiveRecord wasn&#8217;t loaded. I don&#8217;t know why and, at least for now, won&#8217;t dig up the answer.</p>
<p>To work this around, I just created an initializer, at config/initializers called activerecord.rb</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'activerecord'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'yaml'</span>
&nbsp;
config = <span style="color:#CC00FF; font-weight:bold;">YAML</span>.<span style="color:#9900CC;">load_file</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;#{APP_ROOT}/config/database.yml&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
<span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span>.<span style="color:#9900CC;">establish_connection</span> <span style="color:#ff3333; font-weight:bold;">:adapter</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'sqlite3'</span>, <span style="color:#ff3333; font-weight:bold;">:database</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">&quot;#{APP_ROOT}/#{config['database']}&quot;</span></pre></div></div>

<p>And, voilà, you can now create Mac applications using our beloved ActiveRecord.</p>
<p><strong>Update</strong><br />
Alex just gave me the fix for this, just by adding this line to environment.rb:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">config.<span style="color:#9900CC;">frameworks</span> <span style="color:#006600; font-weight:bold;">&lt;&lt;</span> <span style="color:#ff3333; font-weight:bold;">:active_record</span></pre></div></div>

<p>Probably too obvious for me to see. <img src='http://cgweb.com.br/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
</pre>
]]></content:encoded>
			<wfw:commentRss>http://cgweb.com.br/blog/2009/08/bowline-activerecord/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

