<?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>cameronyule.com &#187; rails</title>
	<atom:link href="http://cameronyule.com/tags/rails/feed" rel="self" type="application/rss+xml" />
	<link>http://cameronyule.com</link>
	<description>Glasgow based new media developer Cameron Yule.</description>
	<lastBuildDate>Fri, 22 Jan 2010 12:53:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Mailbuild gem 1.1.1 release</title>
		<link>http://cameronyule.com/2008/11/mailbuild-gem-111-release</link>
		<comments>http://cameronyule.com/2008/11/mailbuild-gem-111-release#comments</comments>
		<pubDate>Fri, 07 Nov 2008 12:05:03 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[mailbuild]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygem]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=331</guid>
		<description><![CDATA[I pushed an update to the Mailbuild gem this morning in response to a bug report from Michael Larocque, who found it wasn&#8217;t properly defaulting to the first List ID if none was specified explicitly. Full details can be found in the commit on the github mirror.]]></description>
			<content:encoded><![CDATA[<p>I pushed an update to the Mailbuild gem this morning in response to a bug report from <a href="http://prolumina.com">Michael Larocque</a>, who found it wasn&#8217;t properly defaulting to the first List ID if none was specified explicitly.</p>
<p>Full details can be found in <a href="http://github.com/cameronyule/mailbuild/commit/cd41013cce5b3a4f8717e9c6e4d0853a692d4ffe">the commit</a> on the github mirror.</p>
]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/11/mailbuild-gem-111-release/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 2.1 YUI Uploader Example</title>
		<link>http://cameronyule.com/2008/10/rails-2-1-yui-uploader-example</link>
		<comments>http://cameronyule.com/2008/10/rails-2-1-yui-uploader-example#comments</comments>
		<pubDate>Thu, 30 Oct 2008 13:03:48 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[attachment_fu]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[csrf]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[yuiuploader]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=327</guid>
		<description><![CDATA[I&#8217;ve finally committed my Rails 2.1 YUI Uploader example, which is a fully-functioning Rails 2.1.2 application demonstrating the use of YUI Uploader, attachment_fu, CSRF protection and the Restful Authentication plugin. It&#8217;s using the latest 2.6.0 release of YUI, which includes the fixes to the the Uploader for Flash Player 10. It&#8217;s up on Github now, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve finally committed my <a href="http://github.com/cameronyule/yui-uploader-rails-authentication/tree">Rails 2.1 YUI Uploader</a> example, which is a fully-functioning Rails 2.1.2 application demonstrating the use of YUI Uploader, attachment_fu, CSRF protection and the Restful Authentication plugin. It&#8217;s using the latest 2.6.0 release of YUI, which includes the fixes to the the Uploader for Flash Player 10.</p>
<p>It&#8217;s up on <a href="http://github.com/cameronyule/yui-uploader-rails-authentication/tree/master">Github</a> now, all the details you&#8217;ll need are in the README.</p>
]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/10/rails-2-1-yui-uploader-example/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>SWFUpload demo update</title>
		<link>http://cameronyule.com/2008/10/swfupload-demo-update</link>
		<comments>http://cameronyule.com/2008/10/swfupload-demo-update#comments</comments>
		<pubDate>Thu, 30 Oct 2008 13:00:15 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[attachment_fu]]></category>
		<category><![CDATA[authentication]]></category>
		<category><![CDATA[csrf]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[swfupload]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=324</guid>
		<description><![CDATA[I&#8217;ve updated the Rails 2.1 SWFUpload example to use the new 2.2.0 Beta 2 release of SWFUpload. The reason for the new release is that there were security changes in Flash Player 10 which prevent JavaScript from causing Flash to show a file dialog &#8211; the browse button is now rendered by Flash itself.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve updated the <a href="https://github.com/cameronyule/swfupload-rails-authentication/tree">Rails 2.1 SWFUpload example</a> to use the new 2.2.0 Beta 2 release of SWFUpload. The reason for the new release is that there were security changes in Flash Player 10 which prevent JavaScript from causing Flash to show a file dialog &#8211; the browse button is now rendered by Flash itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/10/swfupload-demo-update/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Polymorphs &#8216;is not a taggable model&#8217;</title>
		<link>http://cameronyule.com/2008/10/polymorphs-is-not-a-taggable-model</link>
		<comments>http://cameronyule.com/2008/10/polymorphs-is-not-a-taggable-model#comments</comments>
		<pubDate>Mon, 27 Oct 2008 11:17:44 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[has_many_polymorphs]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=311</guid>
		<description><![CDATA[I&#8217;ve been having an issue with Has Many Polymorphs tagging functionality where I was getting a "Model is not a taggable model" error while using the tagging methods. As I&#8217;m not alone in having this problem, here&#8217;s a quick fix. At the bottom of environment.rb; require 'tagging_extensions' require 'tag']]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been having an issue with <a href="http://github.com/fauna/has_many_polymorphs/tree/master">Has Many Polymorphs</a> tagging functionality where I was getting a <code>"Model is not a taggable model"</code> error while using the tagging methods. </p>
<p>As I&#8217;m <a href="https://rubyforge.org/forum/forum.php?thread_id=21365&#038;forum_id=16450">not</a> <a href="https://rubyforge.org/forum/forum.php?thread_id=28883&#038;forum_id=16450">alone</a> in having this problem, here&#8217;s a quick fix. </p>
<p>At the bottom of environment.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;">'tagging_extensions'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'tag'</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/10/polymorphs-is-not-a-taggable-model/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rails staging environment</title>
		<link>http://cameronyule.com/2008/10/rails-staging-environment</link>
		<comments>http://cameronyule.com/2008/10/rails-staging-environment#comments</comments>
		<pubDate>Sun, 26 Oct 2008 17:00:09 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[phusion]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[staging]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=275</guid>
		<description><![CDATA[It&#8217;s easy to forget that Rails isn&#8217;t limited to the default development, test and production environments and I&#8217;ve found a custom staging environment comes in useful. A staging environment is identical to production in terms of caching and performance, but allows you to target configuration settings for testing on your live server. The common use [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s easy to forget that Rails isn&#8217;t limited to the default development, test and production environments and I&#8217;ve found a custom staging environment comes in useful. </p>
<p>A staging environment is identical to production in terms of caching and performance, but allows you to target configuration settings for testing on your live server. </p>
<p>The common use case for me has been commerce applications where you can use the staging environment to automatically switch to your payment provider testing account while everything else is as per production.</p>
<p>Here&#8217;s how you can get a staging environment up and running.</p>
<ol>
<li>Copy production.rb to staging.rb in config/environments</li>
<li>Add a staging entry to your config/database.yml</li>
<li>Assuming your staging DB exists, that&#8217;s it!</li>
</ol>
<p>You can then test it out with mongrel</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby script<span style="color: #000000; font-weight: bold;">/</span>server <span style="color: #660033;">-e</span> staging</pre></div></div>

<p>or alternatively if you use Phusion Passenger (mod_rails)</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> XX.XX.XX.XX:<span style="color: #ff0000;">80</span>&gt; 
  …
  RailsEnv staging  
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/10/rails-staging-environment/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Auditing models with user_stamp</title>
		<link>http://cameronyule.com/2008/10/auditing-models-with-user_stamp</link>
		<comments>http://cameronyule.com/2008/10/auditing-models-with-user_stamp#comments</comments>
		<pubDate>Fri, 24 Oct 2008 09:39:01 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[audit]]></category>
		<category><![CDATA[models]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=277</guid>
		<description><![CDATA[As part of a CMS I&#8217;m building I wanted the ability to audit user interaction with data, to prevent the situation where content is being created, deleted or edited with no record of who did what and when. John Nunemaker recently released his User Stamp plug-in which stamps records with the ID of the users that [...]]]></description>
			<content:encoded><![CDATA[<p>As part of a CMS I&#8217;m building I wanted the ability to audit user interaction with data, to prevent the situation where content is being created, deleted or edited with no record of who did what and when.</p>
<p>John Nunemaker recently released his <a href="http://railstips.org/2008/10/17/who-done-what-a-k-a-user-stamping">User Stamp</a> plug-in which stamps records with the ID of the users that created and last updated. The implementation is quite clever, as he&#8217;s managed to work around the usual hack of storing the current user ID in <code>Thread.current</code> to make it accessible to the model by using a Sweeper, as they have access to controllers (and hence the current_user method).</p>
<p>I&#8217;ve taken his code a bit further by creating a Log model which stores a polymorphic reference to the record affected, the event that occurred (e.g. &#8216;deleted&#8217; or &#8216;updated&#8217;), the current user ID and the time it happened.</p>
<p>The Log model;</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> Log <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#CC00FF; font-weight:bold;"><span style="color:#6666ff; font-weight:bold;">ActiveRecord::Base</span></span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Relationships</span>
  <span style="color:#5A0A0A; font-weight:bold;">belongs_to</span> <span style="color:#ff3333; font-weight:bold;">:user</span>
  <span style="color:#5A0A0A; font-weight:bold;">belongs_to</span> <span style="color:#ff3333; font-weight:bold;">:loggable</span>, <span style="color:#ff3333; font-weight:bold;">:polymorphic</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> :<span style="color:#0000FF; font-weight:bold;">true</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Validations</span>
  <span style="color:#5A0A0A; font-weight:bold;">validates_presence_of</span> <span style="color:#ff3333; font-weight:bold;">:loggable_type</span>
  <span style="color:#5A0A0A; font-weight:bold;">validates_presence_of</span> <span style="color:#ff3333; font-weight:bold;">:loggable_id</span>
  <span style="color:#5A0A0A; font-weight:bold;">validates_presence_of</span> <span style="color:#ff3333; font-weight:bold;">:action</span>
  <span style="color:#5A0A0A; font-weight:bold;">validates_presence_of</span> <span style="color:#ff3333; font-weight:bold;">:user</span>
&nbsp;
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>The migration;</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">class</span> CreateLogs <span style="color:#006600; font-weight:bold;">&lt;</span> <span style="color:#CC00FF; font-weight:bold;"><span style="color:#6666ff; font-weight:bold;">ActiveRecord::Migration</span></span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">up</span>
    create_table <span style="color:#ff3333; font-weight:bold;">:logs</span> <span style="color:#9966CC; font-weight:bold;">do</span> <span style="color:#006600; font-weight:bold;">|</span>t<span style="color:#006600; font-weight:bold;">|</span>
      t.<span style="color:#9900CC;">string</span> <span style="color:#ff3333; font-weight:bold;">:loggable_type</span>
      t.<span style="color:#9900CC;">integer</span> <span style="color:#ff3333; font-weight:bold;">:loggable_id</span>
      t.<span style="color:#9900CC;">string</span> <span style="color:#ff3333; font-weight:bold;">:action</span>
      t.<span style="color:#9900CC;">references</span> <span style="color:#ff3333; font-weight:bold;">:user</span>
      t.<span style="color:#9900CC;">timestamps</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
    add_index <span style="color:#ff3333; font-weight:bold;">:logs</span>, <span style="color:#ff3333; font-weight:bold;">:loggable_id</span>
    add_index <span style="color:#ff3333; font-weight:bold;">:logs</span>, <span style="color:#ff3333; font-weight:bold;">:user_id</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">down</span>
    drop_table <span style="color:#ff3333; font-weight:bold;">:logs</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Additional callback methods added to <code>UserStampSweeper</code>;</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#5A0A0A; font-weight:bold;">after_create</span><span style="color:#006600; font-weight:bold;">&#40;</span>record<span style="color:#006600; font-weight:bold;">&#41;</span>
    add_log<span style="color:#006600; font-weight:bold;">&#40;</span>record, <span style="color:#996600;">'created'</span><span style="color:#006600; font-weight:bold;">&#41;</span>    
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> after_update<span style="color:#006600; font-weight:bold;">&#40;</span>record<span style="color:#006600; font-weight:bold;">&#41;</span>
    add_log<span style="color:#006600; font-weight:bold;">&#40;</span>record, <span style="color:#996600;">'updated'</span><span style="color:#006600; font-weight:bold;">&#41;</span>    
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> after_destroy<span style="color:#006600; font-weight:bold;">&#40;</span>record<span style="color:#006600; font-weight:bold;">&#41;</span>
    add_log<span style="color:#006600; font-weight:bold;">&#40;</span>record, <span style="color:#996600;">'delete'</span><span style="color:#006600; font-weight:bold;">&#41;</span>    
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
  private
  <span style="color:#9966CC; font-weight:bold;">def</span> add_log<span style="color:#006600; font-weight:bold;">&#40;</span>record, action<span style="color:#006600; font-weight:bold;">&#41;</span>
    Log.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span>
      <span style="color:#ff3333; font-weight:bold;">:loggable_type</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> record.<span style="color:#9966CC; font-weight:bold;">class</span>.<span style="color:#5A0A0A; font-weight:bold;">to_s</span>, 
      <span style="color:#ff3333; font-weight:bold;">:loggable_id</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> record.<span style="color:#9900CC;">id</span>, 
      <span style="color:#ff3333; font-weight:bold;">:action</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> action, 
      <span style="color:#ff3333; font-weight:bold;">:user</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> current_user
    <span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span></pre></div></div>

<p>Displaying the logs;</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">for</span> log <span style="color:#9966CC; font-weight:bold;">in</span> <span style="color:#0066ff; font-weight:bold;">@logs</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>
  &lt;tr&gt;
    &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">link_to</span> <span style="color:#006600; font-weight:bold;">&#40;</span>h log.<span style="color:#9900CC;">loggable</span>.<span style="color:#9900CC;">log_name</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:admin</span>, log.<span style="color:#9900CC;">loggable</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;
    &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= h log.<span style="color:#9900CC;">loggable_type</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;
    &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= h log.<span style="color:#9900CC;">action</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;
     &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= <span style="color:#5A0A0A; font-weight:bold;">link_to</span> <span style="color:#006600; font-weight:bold;">&#40;</span>h log.<span style="color:#9900CC;">user</span>.<span style="color:#9900CC;">display_name</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:admin</span>, log.<span style="color:#9900CC;">user</span><span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;
    &lt;td&gt;<span style="color:#006600; font-weight:bold;">&lt;%</span>= log.<span style="color:#9900CC;">created_at</span>.<span style="color:#5A0A0A; font-weight:bold;">to_s</span> <span style="color:#006600; font-weight:bold;">%&gt;</span>&lt;/td&gt;
  &lt;/tr&gt;
<span style="color:#006600; font-weight:bold;">&lt;%</span> <span style="color:#9966CC; font-weight:bold;">end</span> <span style="color:#006600; font-weight:bold;">%&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/10/auditing-models-with-user_stamp/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mailbuild gem 1.1</title>
		<link>http://cameronyule.com/2008/09/mailbuild-gem-1-1</link>
		<comments>http://cameronyule.com/2008/09/mailbuild-gem-1-1#comments</comments>
		<pubDate>Wed, 03 Sep 2008 11:49:49 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[mailbuild]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygem]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=235</guid>
		<description><![CDATA[I've pushed a small update to the <a href="http://rubyforge.org/projects/mailbuild/">Mailbuild gem</a> this morning which adds support for multiple subscriber lists, enabling you to manage different types of subscribers from within your application.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve pushed a small update to the <a href="http://rubyforge.org/projects/mailbuild/">Mailbuild gem</a> this morning which adds support for multiple subscriber lists, enabling you to manage different types of subscribers from within your application.</p>
<p>The <a href="http://github.com/cameronyule/mailbuild-example/tree">sample Rails application</a> has also been updated to take into account the slightly changed syntax for specifying your list id(s);</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">Mailbuild.<span style="color:#9900CC;">list_id</span> = <span style="color:#996600;">'LIST_ID_HERE'</span></pre></div></div>

<p>…is now…</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">Mailbuild.<span style="color:#9900CC;">list_ids</span> = <span style="color:#006600; font-weight:bold;">&#123;</span>:newsletter = <span style="color:#996600;">'LIST_ID_HERE'</span><span style="color:#006600; font-weight:bold;">&#125;</span></pre></div></div>

<p>All API calls take a list id as their last parameter, which defaults to the first id you declare in the list_ids hash. </p>
<p>You can use a specific subscriber list id as follows;</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;">Mailbuild.<span style="color:#5A0A0A; font-weight:bold;">add</span><span style="color:#006600; font-weight:bold;">&#40;</span>params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:email</span><span style="color:#006600; font-weight:bold;">&#93;</span>, params<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:name</span><span style="color:#006600; font-weight:bold;">&#93;</span>, Mailbuild.<span style="color:#9900CC;">list_ids</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#ff3333; font-weight:bold;">:newsletter</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>The <a href="http://mailbuild.rubyforge.org/">documentation</a> explains what parameters each method accepts.</p>
]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/09/mailbuild-gem-1-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ISOdata Rails plugin</title>
		<link>http://cameronyule.com/2008/08/isodata-rails-plugin</link>
		<comments>http://cameronyule.com/2008/08/isodata-rails-plugin#comments</comments>
		<pubDate>Tue, 05 Aug 2008 18:39:14 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[iso]]></category>
		<category><![CDATA[iso3166]]></category>
		<category><![CDATA[iso639]]></category>
		<category><![CDATA[l10n]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=154</guid>
		<description><![CDATA[For anyone working on a Rails application which deals with countries or languages, the official source of data is the International Standards Association, specifically ISO 3166 for countries and ISO 639 for languages. To make it easier to get this data into your Rails application, I&#8217;ve created two generators which automatically create the models, migrations [...]]]></description>
			<content:encoded><![CDATA[<p>For anyone working on a Rails application which deals with countries or languages, the official source of data is the <a href="http://www.iso.org/">International Standards Association</a>, specifically ISO 3166 for countries and ISO 639 for languages.</p>
<p>To make it easier to get this data into your Rails application, I&#8217;ve created two generators which automatically create the models, migrations and data you&#8217;ll need and bundled them up in a handy <a href="http://github.com/cameronyule/isodata/tree/master">Rails plug-in</a>.</p>
<p>Usage couldn&#8217;t be simpler…</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>plugin <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">git</span>:<span style="color: #000000; font-weight: bold;">//</span>github.com<span style="color: #000000; font-weight: bold;">/</span>cameronyule<span style="color: #000000; font-weight: bold;">/</span>isodata.git</pre></div></div>

<p>If you want country data…</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>generate countries
rake db:migrate
rake isodata:db:countries</pre></div></div>

<p>…and for languages…</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>generate languages
rake db:migrate
rake isodata:db:languages</pre></div></div>

<p>Check out the <a href="http://github.com/cameronyule/isodata/tree/master">isodata project</a> on Github.</p>
]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/08/isodata-rails-plugin/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 2.1 SWFUpload Example</title>
		<link>http://cameronyule.com/2008/07/rails-21-swfupload-example</link>
		<comments>http://cameronyule.com/2008/07/rails-21-swfupload-example#comments</comments>
		<pubDate>Thu, 31 Jul 2008 11:39:18 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[attachment_fu]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[restful-authentication]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[swfupload]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=142</guid>
		<description><![CDATA[There&#8217;s been a few posts lately on getting SWFUpload working with Rails 2.1, attachment_fu and the restful-authentication plugins. To try and make things easier, I&#8217;ve made a sample &#8211; albeit basic &#8211; Rails application to show other people how I managed it. I&#8217;ve created a project on Github to host it, feel free to check [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s been a few posts lately on getting <a href="http://swfupload.org/">SWFUpload</a> working with Rails 2.1, attachment_fu and the restful-authentication plugins. </p>
<p>To try and make things easier, I&#8217;ve made a sample &#8211; albeit basic &#8211; Rails application to show other people how I managed it.</p>
<p>I&#8217;ve <a href="http://github.com/cameronyule/swfupload-rails-authentication/tree/master">created a project</a> on Github to host it, feel free to check it out and let me know how you get on. The only instructions you should need are in the README file, but feel free to leave comments here if you do need a hand.</p>
]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/07/rails-21-swfupload-example/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>A Ruby/Rails interface to Mailbuild API</title>
		<link>http://cameronyule.com/2008/07/a-rubyrails-interface-to-mailbuild-api</link>
		<comments>http://cameronyule.com/2008/07/a-rubyrails-interface-to-mailbuild-api#comments</comments>
		<pubDate>Thu, 24 Jul 2008 16:19:17 +0000</pubDate>
		<dc:creator>Cameron</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[mailbuild]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygem]]></category>

		<guid isPermaLink="false">http://cameronyule.com/?p=103</guid>
		<description><![CDATA[I&#8217;m pleased to announce the release of the first version of my Mailbuild API interface, which I&#8217;m distributing as a Rubygem. To make it easier to figure out how to use it, I&#8217;ve also created a fully functional Rails application which demonstrates all the API calls available. To use it all you have to do [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m pleased to announce the release of the first version of my <a href="http://rubyforge.org/projects/mailbuild/">Mailbuild API interface</a>, which I&#8217;m distributing as a Rubygem.</p>
<p>To make it easier to figure out how to use it, I&#8217;ve also created a fully functional Rails application which demonstrates all the API calls available. </p>
<p>To use it all you have to do is grab a copy from subversion…</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> http:<span style="color: #000000; font-weight: bold;">//</span>mailbuild.rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>rails_mailbuild_example<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>… make sure you have the mailbuild gem installed …</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> rails_mailbuild_example
<span style="color: #666666; font-style: italic;"># OS X/Linux users may have to prefix this with sudo</span>
rake gems:<span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>… and edit config/initializers/mailbuild.rb, adding your own API key, List ID and sub-domain.</p>

<div class="wp_syntax"><div class="code"><pre class="rails" style="font-family:monospace;"><span style="color:#008000; font-style:italic;"># You can get this information from your Mailbuild admin</span>
Mailbuild.<span style="color:#9900CC;">api_key</span> = <span style="color:#996600;">''</span>
Mailbuild.<span style="color:#9900CC;">list_id</span> = <span style="color:#996600;">''</span>
Mailbuild.<span style="color:#9900CC;">subdomain</span> = <span style="color:#996600;">''</span></pre></div></div>

<p>Hopefully that&#8217;s all there is to it, but if you run into any problems feel free to add a <a href="http://rubyforge.org/tracker/?atid=16671&#038;group_id=4326&#038;func=browse">support request</a> or <a href="http://rubyforge.org/tracker/?atid=16670&#038;group_id=4326&#038;func=browse">bug report</a> on Rubyforge.</p>
]]></content:encoded>
			<wfw:commentRss>http://cameronyule.com/2008/07/a-rubyrails-interface-to-mailbuild-api/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

