<?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>Rails on the Run &#187; edge</title>
	<atom:link href="http://railsontherun.com/tag/edge/feed/" rel="self" type="application/rss+xml" />
	<link>http://railsontherun.com</link>
	<description>Rails experiments by Matt Aimonetti</description>
	<lastBuildDate>Tue, 23 Feb 2010 07:28:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Edge: more clean up</title>
		<link>http://railsontherun.com/2007/09/11/edge-more-clean-up/</link>
		<comments>http://railsontherun.com/2007/09/11/edge-more-clean-up/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 05:55:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[acts_as_nested_set]]></category>
		<category><![CDATA[acts_as_tree]]></category>
		<category><![CDATA[auto_complete]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[prototype]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rails2]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/09/11/edge-more-clean-up</guid>
		<description><![CDATA[As posted yesterday Rails slimmed down during the last few days. This time, acts astree has been moved into a plugin 7454 as well as acts as nested set 7453 and autocomplete 7450 Here are the official plugins. Don&#8217;t worry if you were using Edge, you simply need to use piston and install what you [...]]]></description>
			<content:encoded><![CDATA[<p>As <a href="http://railsontherun.com/2007/9/10/dhh-and-team-busy-cleaning-up-edge">posted yesterday</a> Rails slimmed down during the last few days.</p>
<p>This time, <strong>acts as<em>tree</strong> <a href="http://dev.rubyonrails.org/browser/plugins/acts as_tree">has been moved into a plugin</a>    <a href="http://dev.rubyonrails.org/changeset/7454">7454</a> as well as <a href="http://dev.rubyonrails.org/browser/plugins/acts_as_nested_set"><strong>acts as nested set</strong> </a>  <a href="http://dev.rubyonrails.org/changeset/7453">7453</a> and <a href="http://dev.rubyonrails.org/browser/plugins/auto_complete"><strong>auto</em>complete</strong></a>  <a href="http://dev.rubyonrails.org/changeset/7450">7450</a> </p>
<p>Here are the <a href="http://dev.rubyonrails.org/browser/plugins">official plugins</a>. Don&#8217;t worry if you were using Edge, you simply need to use <a href="http://piston.rubyforge.org/usage.html">piston</a> and install what you need in your project.</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/09/11/edge-more-clean-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DHH and team busy cleaning up Edge</title>
		<link>http://railsontherun.com/2007/09/10/dhh-and-team-busy-cleaning-up-edge/</link>
		<comments>http://railsontherun.com/2007/09/10/dhh-and-team-busy-cleaning-up-edge/#comments</comments>
		<pubDate>Mon, 10 Sep 2007 15:12:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[acts_as_list. in_place_editor]]></category>
		<category><![CDATA[changes]]></category>
		<category><![CDATA[dhh]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[scaffold]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/09/10/dhh-and-team-busy-cleaning-up-edge</guid>
		<description><![CDATA[DHH and nzkoz have been busy this week end cleaning up Edge and pushing some features to plugins. acts_as_list became a plugin ( 7443 / 7444 ) in_place editing was also moved out as a plugin ( 7441 / 7442 ) Scaffold is gone ( 7429 ) ( Jordan McKible post ) The Rails core [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.loudthinking.com/">DHH</a> and <a href="http://www.koziarski.net/">nzkoz</a> have been busy this week end cleaning up Edge and   pushing some features to plugins.</p>
<ul>
<li>acts_as_list became a <a href="http://dev.rubyonrails.org/browser/plugins/acts_as_list">plugin</a> ( <a href="http://dev.rubyonrails.org/changeset/7443">7443</a> / <a href="http://dev.rubyonrails.org/changeset/7444">7444</a> )</li>
<li>in_place editing was also moved out as a <a href="http://dev.rubyonrails.org/browser/plugins/in_place_editing">plugin</a> ( <a href="http://dev.rubyonrails.org/changeset/7441">7441</a> / <a href="http://dev.rubyonrails.org/changeset/7442">7442</a> )</li>
<li>Scaffold is gone ( <a href="http://dev.rubyonrails.org/changeset/7429">7429</a> ) ( <a href="http://tuples.us/2007/09/09/scaffold-is-gone/">Jordan McKible post</a> )</li>
</ul>
<p>The Rails core team is trying to keep the core light and agile and I believe it&#8217;s a good thing. Hopefully we are getting closer to a 2.0 release.</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/09/10/dhh-and-team-busy-cleaning-up-edge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>attachment_fu, Flash and to_xml tips</title>
		<link>http://railsontherun.com/2007/07/21/attachment_fu-flash-and-to_xml-tips/</link>
		<comments>http://railsontherun.com/2007/07/21/attachment_fu-flash-and-to_xml-tips/#comments</comments>
		<pubDate>Sat, 21 Jul 2007 03:30:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[attachment]]></category>
		<category><![CDATA[attachment_fu]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[to_xml]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/07/21/attachment_fu-flash-and-to_xml-tips</guid>
		<description><![CDATA[I recently had to deal with an interesting challenge. I had to write a simple interface between a rails app and a Flash application. Nothing hard and if you browse the archives, you&#8217;ll find examples and tutorials on how to create a REST interface to communicate between Rails and Flash. The thing was that this [...]]]></description>
			<content:encoded><![CDATA[<p>I recently had to deal with an interesting challenge. I had to write a simple interface between a rails app and a Flash application. Nothing hard and if you browse the archives, you&#8217;ll find examples and tutorials on how to create a REST interface to communicate between Rails and Flash.</p>
<p>The thing was that this time I had to interface with a model using <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment<em>fu</a>. I&#8217;m a great fan of a</em>fu and it&#8217;s definitely the best way of dealing with uploads. </p>
<p>My model looked more or less like that:</p>
<pre><code>class Photo &lt; ActiveRecord::Base

belongs_to :user

  has_attachment(
    :content_type =&gt; :image,
    :storage =&gt; :file_system,
    :max_size =&gt; 10.megabytes,
    :resize_to =&gt; '640x480&gt;',
    :thumbnails =&gt; { :thumb =&gt; '100x100&gt;',
                              :preview =&gt; '300x200&gt;',
                     }
  )
  validates_as_attachment
  # read more about validates_existence_of http://blog.hasmanythrough.com/2007/7/14/validate-your-existence
  validates_existence_of :user
end
</code></pre>
<p>My show action in my photo controller could have looked a bit like that:</p>
<pre><code>respond_to do |format|
  format.html # show.html.erb
  format.xml  { render <img src='http://railsontherun.com/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml =&gt; @photo }
end
</code></pre>
<p>That&#8217;s great, the problem is that we are displaying a lot of information that our Flash client doesn&#8217;t need to see, actually we are exposing a lot of information nobody should ever see and we are not displaying what we should. On top of being a waste of bandwidth and giving too much work to the client, we are not actually providing the user with the details of the thumbnail.</p>
<p>The first thing to do would be not to display some of the object attributes, the to_xml method lets you do that. </p>
<p>Note that in Edge, Rails will automatically try to convert your object using to<em>xml, you don&#8217;t even need to mention it. However in our case, we want to use some _advanced</em> features offered by to_xml, and here is how our code should look like:  </p>
<pre><code>format.xml do
  render <img src='http://railsontherun.com/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml =&gt; @photo.to_xml( :except =&gt; [ :id, :filename, :updated_at, :user_id, :height, :width], :skip_types =&gt; true )
end
</code></pre>
<p>What I just did is very simple, we rendered our object as an xml object but we didn&#8217;t convert few attributes, :id, :filename, :updated<em>at, :user</em>id, :height, :width. By default Rails also adds the object type, we don&#8217;t really need that right now, so let&#8217;s skip them.<br/><br />
(The reason why I don&#8217;t want to convert the filename is that I want to provide our Flash client with the photo thumbnail instead of the original picture.)</p>
<p>As far as I know, to_xml doesn&#8217;t let you create new attributes. (if I have some time, I&#8217;ll submit a patch to get that added).</p>
<p>What we are trying to do is to display the avatar of a user. We found the photo record using @user.photo but that&#8217;s the original photo and we want to provide Flash with the avatar info, not the original.</p>
<p>What we need to do is to simply add a new attribute called avatar:</p>
<pre><code>format.xml do
  @photo[:avatar] = @photo.public_filename(:thumb)
  render <img src='http://railsontherun.com/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml =&gt; @photo.to_xml( :except =&gt; [ :id, :filename, :updated_at, :user_id, :height, :width], :skip_types =&gt; true )
end
</code></pre>
<p>Simple enough, but it took me a little while to figure it out <img src='http://railsontherun.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Voila, we now have a clean, trimmed and safe XML returned object that you can be consumed by our Flash client. Ohh, and we added a new attribute that the original object didn&#8217;t have <img src='http://railsontherun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/07/21/attachment_fu-flash-and-to_xml-tips/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Rails Edge / RSpec project</title>
		<link>http://railsontherun.com/2007/06/06/create-a-rails-edge-rspec-project/</link>
		<comments>http://railsontherun.com/2007/06/06/create-a-rails-edge-rspec-project/#comments</comments>
		<pubDate>Wed, 06 Jun 2007 19:34:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[autotest]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[edge]]></category>
		<category><![CDATA[growl]]></category>
		<category><![CDATA[hackfest]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[RSpec]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[texmate]]></category>
		<category><![CDATA[zentest]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/06/06/create-a-rails-edge-rspec-project</guid>
		<description><![CDATA[Recently I helped few people moving to Rails Edge and start using RSpec. I realized that I learned few tricks and even if for me everything seemed quite simple, things are not that simple when you recently started with Rails. This would work on Mac and Linux, sorry Windows users, you&#8217;ll have to slightly change [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I helped few people moving to <a href="http://dev.rubyonrails.org/">Rails Edge</a> and start using <a href="http://rspec.rubyforge.org">RSpec</a>. I realized that I learned few tricks and even if for me everything seemed quite simple, things are not that simple when you recently started with Rails.</p>
<p>This would work on Mac and Linux, sorry Windows users, you&#8217;ll have to slightly change the code below.</p>
<h1>Live on the Edge</h1>
<p>This is actually a bit tricky but it was very well covered by <a href="http://addictedtonew.com/about/">John Nunemaker</a> in <a href="http://railstips.org/2007/5/31/even-edgier-than-edge-rails">this post</a></p>
<p>To sum John&#8217;s post:</p>
<p>Create a normal rails project:</p>
<pre><code>$ rails my_project
$ cd my_project

$ rake rails:freeze:edge
</code></pre>
<p>(or use checkout edge in the vendor folder)</p>
<pre><code>$ cd ..
$ ruby my_project/vendor/rails/railties/bin/rails my_edgie_project
</code></pre>
<p>You now have have a real Edge project called my<em>edgie</em>project. You can delete the my_project folder since we only used it to create our real edge project.</p>
<p>Now, we are not really done since we need to add the Edge files into our vendor folder so we don&#8217;t use our local rails gem.</p>
<p>I would refer to another post from John, that you can find <a href="http://railstips.org/2007/3/5/my-local-rails-setup">there</a></p>
<pre><code>$ mkdir ~/rails
$ cd ~/rails
$ svn co http://dev.rubyonrails.com/svn/rails/trunk .
</code></pre>
<p>We just created a rails folder called rails in our home folder and we checked out edge/trunk in it.<br />
Now let&#8217;s go in our Rails app and setup a symlink to the trunk folder we just created.</p>
<pre><code>$ cd ~/rails_projects/my_edgie_project
$ ln -s ~/rails/trunk vendor/rails
</code></pre>
<p>If you are using subversion, you can ignore the symlink so it doesnâ€™t try to version it:</p>
<pre><code>$ svn propset svn:ignore "rails" vendor/
$ svn commit -m "using new sweet rails setup as recommended by John Nunemaker"
$ svn up
</code></pre>
<p><a href="http://railstips.org/2007/3/5/my-local-rails-setup">Read more</a> for advanced settings etc&#8230;</p>
<h1>Install RSpec</h1>
<p>Very straight forward, you just need to follow <a href="http://rspec.rubyforge.org/documentation/rails/install.html">the documentation</a></p>
<pre><code>$ cd ~/rails_projects/my_edgie_project
$ ruby script/plugin install svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec
$ ruby script/plugin install svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec_on_rails
</code></pre>
<p>If you have TextMate, you might want to download the <a href="http://rubyforge.org/frs/?group_id=797">latest RSpec-X.Y.Z.tmbundle.tgz Bundle</a></p>
<p>Next thing you want to do is to install <a href="http://www.zenspider.com/ZSS/Products/ZenTest/">ZenTest</a></p>
<pre><code>$ sudo gem install ZenTest
</code></pre>
<p>Make sure you install all the required packages.</p>
<p>If you are using <a href="http://growl.info/">Growl</a> create a new file called .autotest in your home directory:</p>
<pre><code>$mate ~./autotest
</code></pre>
<p>and add the following 2 lines to be warned when your specs/examples fail/pass</p>
<pre><code>require 'autotest/redgreen'
require 'autotest/growl'
</code></pre>
<p>Now, lets go back to our project and create a model using the rspec scaffold (it uses scaffold_resource generator and create all the specs for you)</p>
<pre><code>$ cd ~/rails_projects/my_edgie_project
$ ruby script/generate rspec_scaffold User first_name:string last_name:string :age:integer
</code></pre>
<p>Now, let&#8217;s start autotest (from zentest) so out code is tested in the background</p>
<pre><code>$ autotest
</code></pre>
<p>There you go, really to modify your RSpec examples, make them fail, fix your code, examples should pass, refactor your code and start again <img src='http://railsontherun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/06/06/create-a-rails-edge-rspec-project/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

