<?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; plugin</title>
	<atom:link href="http://railsontherun.com/tag/plugin/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>Attachment_fu updated!</title>
		<link>http://railsontherun.com/2007/11/28/attachment_fu-updated/</link>
		<comments>http://railsontherun.com/2007/11/28/attachment_fu-updated/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 08:26:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[attachment_fu]]></category>
		<category><![CDATA[imagescience]]></category>
		<category><![CDATA[minimagick]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rmagick]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/11/28/attachment_fu-updated</guid>
		<description><![CDATA[I recently bugged Rick Olson so much about attachment_fu that he gave me SVN access to fix few bugs. Rick being really busy with ActiveReload he didn&#8217;t spend too much time maintaining attachment_fu. On my side of things, I&#8217;ve been using attachment_fu on a lot of projects and I&#8217;ve been fixing bugs and adding new [...]]]></description>
			<content:encoded><![CDATA[<p>I recently bugged <a href="http://techno-weenie.net/">Rick Olson</a> so much about <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a> that he gave me SVN access to fix few bugs.</p>
<p>Rick being really busy with <a href="http://activereload.net/">ActiveReload</a> he didn&#8217;t spend too much time maintaining <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a>.</p>
<p>On my side of things, I&#8217;ve been using <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a> on a lot of projects and I&#8217;ve been fixing bugs and adding new features.</p>
<p>My first contribution to <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a> is a fix for the <a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a> processor.</p>
<p>Attachment_fu is very flexible and let you use your favorite image processor:</p>
<ul>
<li><a href="http://rmagick.rubyforge.org/">RMagick</a> based on <a href="http://www.imagemagick.org/script/mogrify.php">ImageMagick</a> and <a href="http://www.graphicsmagick.org/">GraphicsMagick</a>(known to leak memory and being a pain to setup)</li>
<li><a href="http://rubyforge.org/projects/mini-magick/">minimagick</a> based on <a href="http://www.imagemagick.org/script/mogrify.php">ImageMagick</a></li>
<li><a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a> based on <a href="http://sf.net/projects/freeimage">FreeImage</a>. </li>
</ul>
<p>Like many rubyists, I like <a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a> for its simplicity and efficiency. However, <a href="http://svn.techno-weenie.net/projects/plugins/attachment_fu/">attachment_fu</a> had few problems when being used with <a href="http://seattlerb.rubyforge.org/ImageScience.html">ImageScience</a>.</p>
<ul>
<li>File sizes for thumbnails were not saved correctly in the database. Fixed</li>
<li>Thumbnails based on a gif files were not processed properly. So, this was the big problem. <a href="http://sf.net/projects/freeimage">FreeImage</a> has issues dealing with resizing gif files because of the gif palette limitation (256 colors). to avoid this problem thumbnails of gif files are converted to png. However the thumbnail content type info in the database was not saved properly. That&#8217;s now fixed.</li>
<li>Because of the gif bug reported above, any thumbnail link was broken since it was trying to link to the thumbnail version with a gif extension instead of a png one. Fixed</li>
</ul>
<p>I also fixed a small bug related to <a href="http://www.amazon.com/gp/browse.html?node=16427261">S3 storage</a> and the fact that a_fu had issues loading the config file. (Fixed)</p>
<p>I&#8217;ll also try be able to add some of the S3 features I&#8217;ve been working on. As well as maybe enhancing the validation process. </p>
<p>In the mean time, you might want to read <a href="http://the.railsi.st/2007/11/27/roll-your-own-attachment_fu-validations">this blog post</a> about better validation with attachment_fu.</p>
<p>If you are heavily using attachment_fu or starting using it and think that a google group would be great idea, please let me know in the comment and I&#8217;ll try to convince Technoweenie that we need to set that up <img src='http://railsontherun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Ooohh I almost forgot, if you fixed some bugs you found while using a<em>fu, please contact me so we can get a</em>fu bug free.</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/11/28/attachment_fu-updated/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>new plugin to manage your backups</title>
		<link>http://railsontherun.com/2007/07/24/new-plugin-to-manage-your-backups/</link>
		<comments>http://railsontherun.com/2007/07/24/new-plugin-to-manage-your-backups/#comments</comments>
		<pubDate>Tue, 24 Jul 2007 06:18:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[active record]]></category>
		<category><![CDATA[ar]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[restore]]></category>
		<category><![CDATA[sake]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/07/24/new-plugin-to-manage-your-backups</guid>
		<description><![CDATA[I just released a simple plugin that I use to backup and restore databases instead of using a mysql dump. check out the plugin page File structure will look like that: I use this plugin to backup my apps running in production. When I need to debug an application, I just need to restore the [...]]]></description>
			<content:encoded><![CDATA[<p>I just released a simple plugin that I use to backup and restore databases instead of using a mysql dump.</p>
<p><a href="http://code.google.com/p/ar-backup/">check out the plugin page</a></p>
<p>File structure will look like that:</p>
<p><img src="http://farm2.static.flickr.com/1054/882951034_343db15424_o.jpg" alt="ar-backup"/></p>
<p>I use this plugin to backup my apps running in production. When I need to debug an application, I just need to restore the db locally and debug. The fact that it uses fixtures helps me finding data quickly and I can easily decide to only restore few tables. </p>
<p>I also have a Capistrano recipe to create backups before each deployment.</p>
<p>oohh and the plugin is <a href="http://errtheblog.com/post/6069">Sake</a> compatible, give it a try <img src='http://railsontherun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Enjoy</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/07/24/new-plugin-to-manage-your-backups/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>restful_authentication and RSpec tip</title>
		<link>http://railsontherun.com/2007/07/13/restful_authentication-and-rspec-tip/</link>
		<comments>http://railsontherun.com/2007/07/13/restful_authentication-and-rspec-tip/#comments</comments>
		<pubDate>Fri, 13 Jul 2007 05:55:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[BDD]]></category>
		<category><![CDATA[helper]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[restful]]></category>
		<category><![CDATA[restful_authentication]]></category>
		<category><![CDATA[RSpec]]></category>
		<category><![CDATA[tests]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/07/13/restful_authentication-and-rspec-tip</guid>
		<description><![CDATA[resftul_authentication is a great plugin, but not always resftful&#8230; especially if like me you dropped unit test for RSpec. I have a set of RSpec examples I use all the time on all my projects requiring restful_authentication, obviously I always end up tweaking them because each application has its specific needs. However, I was recently [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://svn.techno-weenie.net/projects/plugins/restful_authentication/">resftul_authentication</a> is a great plugin, but not always resftful&#8230; especially if like me you dropped unit test for RSpec.</p>
<p><img src="http://myskitch.com/matt_a/p-restful_24x40.jpg__jpeg_image__2224x1475_pixels__-_scaled__43__-20070712-224940.jpg" width='490px' alt="" title=""></p>
<p>I have a set of RSpec examples I use all the time on all my projects requiring restful_authentication, obviously I always end up tweaking them because each application has its specific needs.</p>
<p>However, I was recently asked <em>what&#8217;s the way of dealing with controllers specs when a controller has a limited access ?</em></p>
<p>Let&#8217;s look at the following controller for instance:</p>
<pre><code>class AssetController &lt; ApplicationController
 before_filter :login_required, :except =&gt; [ :index, :show ]
</code></pre>
<p>my assets_controller_spec.rb file will have the following code:</p>
<pre><code>describe AssetController, "handling GET /assets/new" do

  before do
    @asset = mock_model(Asset)
    Asset.stub!(:new).and_return(@asset)
  end

  def do_get
    get :new
  end

  it "should be successful" do
    do_get
    response.should be_success
  end

end
</code></pre>
<p>and guess what&#8230; it will fail! Why? simply because we are trying to access an action requiring login. Right, so what&#8217;s the best way of dealing with this issue and get our test to pass?</p>
<p>The best solution I found was to use a simple helper that I put in my spec_helper.rb file</p>
<pre><code>def login_as(user)
  case user
    when :admin
      @current_user = mock_model(User)
      User.should_receive(:find_by_id).any_number_of_times.and_return(@current_user)
      request.session[:user] = @current_user
    else
      request.session[:user] = nil
  end
end
</code></pre>
<p>You might wonder why I use when :user, well, in a lot of the application I&#8217;m working on, I have different levels of access and  I want to tests different accounts so I the case conditional loop.</p>
<p>Anyway, let&#8217;s implement our helper in our previous RSpec example:</p>
<pre><code>describe AssetController, "handling GET /assets/new" do

  before do
    login_as :admin
    @asset = mock_model(Asset)
    Asset.stub!(:new).and_return(@asset)
  end

  def do_get
    get :new
  end

  it "should be successful" do
    do_get
    response.should be_success
  end

end
</code></pre>
<p>and there you go, now your example passes properly <img src='http://railsontherun.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Have fun</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/07/13/restful_authentication-and-rspec-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mimetype_fu update</title>
		<link>http://railsontherun.com/2007/06/22/mimetype_fu-update/</link>
		<comments>http://railsontherun.com/2007/06/22/mimetype_fu-update/#comments</comments>
		<pubDate>Fri, 22 Jun 2007 06:07:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[mime type\']]></category>
		<category><![CDATA[mimetype_fu]]></category>
		<category><![CDATA[ninja]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/06/22/mimetype_fu-update</guid>
		<description><![CDATA[Quick note to let you know that I updated mimetype_fu to actually get the mime type of a file using the file command on mac and linux. I still didn&#8217;t post an example since I&#8217;m planning on writing a patch for attachment_fu.]]></description>
			<content:encoded><![CDATA[<p>Quick note to let you know that I updated mimetype_fu to actually get the mime type of a file using the file command on mac and linux. I still didn&#8217;t post an example since I&#8217;m planning on writing a patch for attachment_fu.</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/06/22/mimetype_fu-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Globalite or another i18n/l10n solution</title>
		<link>http://railsontherun.com/2007/05/15/globalite-i18n-i10n-solution/</link>
		<comments>http://railsontherun.com/2007/05/15/globalite-i18n-i10n-solution/#comments</comments>
		<pubDate>Tue, 15 May 2007 15:58:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[globalite]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[internationalization]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[localization]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[translation]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/06/14/globalite-i18n-i10n-solution</guid>
		<description><![CDATA[I&#8217;ve been recently slightly annoyed by the lack of simple yet powerful internationalization/localization plugin for Rails. It seems like the only real solution out there is Globalize However, it&#8217;s a heavy, bloated, hard to setup plugin. I might seem to complain, but I&#8217;m actually glad that someone came up with a decent solution. Globalize is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been recently slightly annoyed by the lack of simple yet powerful internationalization/localization plugin for Rails.<br />
It seems like the only real solution out there is <a href="http://www.globalize-rails.org">Globalize</a> </p>
<p>However, it&#8217;s a heavy, bloated, hard to setup plugin. I might seem to complain, but I&#8217;m actually glad that someone came up with a decent solution. Globalize is quite powerful but I would like to see something simpler, lighter and easier to use.</p>
<p>While I was looking for alternate solutions, <a href="http://errtheblog.com/">Err</a> released <a href="http://errtheblog.com/post/4396">Gibberish</a> a simple and nice localization plugin.</p>
<p>Looking at Chris&#8217; code, I found a clean and nice solution but unfortunately too simple. The major problem I had with Giberrish was the lack of support for locales. That means that one cannot create an application supporting British English and American English. I lived in  both America and the UK and believe me, I can never spell some words properly. How should I spell the following words: colours or colors, behaviour or behavior, aluminium or aluminum? On top of that, your UI might be slightly different based on the region your visitor is coming from. Localization is more than translation.</p>
<p>Anyway, I decided to come up with my own solution, a breed of the best features from my favorite i18n/l10n projects. This hybrid solution should, hopefully be useful for people not needing all the resources of Globalize. I called my new project <em>Globa_lite_</em></p>
<h2>What&#8217;s cool with Globalite?</h2>
<ul>
<li>
<p>Simple UI localization</p>
<ul>
<li>support different locales</li>
<li>yml file based</li>
<li>simple syntax</li>
<li>no setup needed</li>
<li>enough for most projects needing localization</li>
<li>pass variables to the localization and let the translator deal with it</li>
</ul>
</li>
<li>
<p>Simple Rails Localization</p>
<ul>
<li>support different locales</li>
<li>nothing to do, rails comes in your own language (including currency conversion and other helpers)</li>
<li>yml file based localization for easy update</li>
<li>support for Rails 1.2x</li>
<li>simple to maintain</li>
<li>simple to add/edit a new locale</li>
</ul>
</li>
<li>
<p>Simple content i18n/l10n (coming soon)</p>
</li>
</ul>
<h2>UI localization:</h2>
<ul>
<li>Create a lang/ui folder at the root of the folder.</li>
<li>create 2 localization files: fr.yml and en-US.yml</li>
<li>add localization keys in the files:</li>
</ul>
<p>fr.yml:</p>
<pre><code>hello: bonjour

welcome: bienvenue
</code></pre>
<p>en-US.yml</p>
<pre><code>hello: howdy

welcome: welcome
</code></pre>
<ul>
<li>
<p>Declare the current locale or language </p>
<pre><code>Globalite.current_language :fr
</code></pre>
</li>
<li>
<p>In your view (or anywhere else) localize a key </p>
<pre><code>:hello.l
</code></pre>
</li>
</ul>
<p>or</p>
<pre><code>:hello.localize
</code></pre>
<p>you can also do </p>
<pre><code>:unknown_key.l("this is the default text to display if the localization isn't found")
</code></pre>
<p>Also you can pass one or many variables to the localization(check the documentation)</p>
<h2>Rails Localization</h2>
<p>Rails is automatically localized for you (meaning most helpers, including the currency converter are localized for the locale you declared).<br />
You really easily add a new supported rails language/settings by adding a yml file or editing an existing one. (for now, I only create an English and a French localization file, but I&#8217;ll add plenty more very soon)</p>
<p>Globalite also saves the locale in the session allowing many users to see a site at the same time in different languages <img src='http://railsontherun.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I believe Globalite is/will be a good solution for most of my international projects. It still lacks the content i18n and l10n as well as support for pluralization but it should be added soon.</p>
<p>Give it a try and let me know what you think:</p>
<p><a href="http://rubyforge.org/projects/globalite">RubyForge page</a></p>
<p>svn repository: svn checkout svn://rubyforge.org/var/svn/globalite/trunk globalite</p>
<p><a href="http://viewvc.rubyforge.mmmultiworks.com/cgi/viewvc.cgi/?root=globalite">view repository content</a></p>
<p>ps: The project is still in beta and will change during the next few weeks, feel free to submit patches, ideas, suggestions&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/05/15/globalite-i18n-i10n-solution/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Rails, sexier than ever.</title>
		<link>http://railsontherun.com/2007/03/30/rails-sexier-than-ever/</link>
		<comments>http://railsontherun.com/2007/03/30/rails-sexier-than-ever/#comments</comments>
		<pubDate>Fri, 30 Mar 2007 15:43:00 +0000</pubDate>
		<dc:creator>Matt Aimonetti</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://railsontherun.com/2007/03/30/rails-sexier-than-ever</guid>
		<description><![CDATA[3 days ago, Edge was patched to add a nicer syntax to our dear migrations. Instead of doing: create_table :people do &#124;t&#124; t.column :name, :string t.column :age, :integer end You can now do: create_table :people do &#124;t&#124; t.name :string t.age :integer end While this is great, I found out that someone came up with an [...]]]></description>
			<content:encoded><![CDATA[<p>3 days ago, <a href="http://dev.rubyonrails.org/ticket/7932">Edge was patched</a> to add a nicer syntax to our dear migrations.</p>
<p>Instead of doing:<br/><br />
    create_table :people do |t|<br />
      t.column :name, :string<br />
      t.column :age,  :integer<br />
    end<br />
You can now do:<br />
    create_table :people do |t|<br />
      t.name :string<br />
      t.age  :integer<br />
    end</p>
<p>While this is great, I found out that <a href="http://err.lighthouseapp.com/projects/466-plugins">someone</a> came up with an even nicer way of creating your migration, actually, a sexier way of doing migrations, and we all like sexy, don&#8217;t we? Otherwise we would not use Rails, would we?</p>
<p>Anyway thanks to this new plugin, your old Migration:</p>
<pre><code>class UpdateYourFamily &lt; ActiveRecord::Migration
  create_table :updates do |t|
    t.column :user_id,  :integer
    t.column :group_id, :integer
    t.column :body,     :text
    t.column :type,     :string

    t.column :created_at, :datetime
    t.column :updated_at, :datetime
  end

  def self.down
    drop_table :updates
  end
end
</code></pre>
<p>can look sexier than ever:<br />
    class UpdateYourFamily &lt; ActiveRecord::Migration<br />
      create_table :updates do<br />
        foreign_key :user<br />
        foreign_key :group</p>
<pre><code>    text   :body
    string :type

    timestamps!
  end

  def self.down
    drop_table :updates
  end
end
</code></pre>
<p>Note that I didn&#8217;t test the code above and the self.up method seems to be missing, for more information, check the <a href="http://errtheblog.com/post/2381">official post</a> to give it a try:<br />
    ./script/plugin install svn://errtheblog.com/svn/plugins/sexy_migrations</p>
]]></content:encoded>
			<wfw:commentRss>http://railsontherun.com/2007/03/30/rails-sexier-than-ever/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

