<?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>casperfabricius.com &#187; radiant</title>
	<atom:link href="http://casperfabricius.com/site/category/radiant/feed/" rel="self" type="application/rss+xml" />
	<link>http://casperfabricius.com/site</link>
	<description>expert ruby on rails development</description>
	<lastBuildDate>Sun, 06 Jun 2010 08:43:31 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>10 extensions for Radiant CMS you can&#8217;t live without</title>
		<link>http://casperfabricius.com/site/2009/01/25/10-extensions-for-radiant-cms-you-cant-live-without/</link>
		<comments>http://casperfabricius.com/site/2009/01/25/10-extensions-for-radiant-cms-you-cant-live-without/#comments</comments>
		<pubDate>Sun, 25 Jan 2009 14:28:01 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />
		<category><![CDATA[radiant]]></category>
		<category><![CDATA[rails]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=168</guid>
		<description><![CDATA[Radiant CMS is a great content management system. It&#8217;s Rails, it&#8217;s simple &#8230; in fact it is so simple that you are bound to be missing some basic features once you start implementing your web site.
This is by design. Radiant has a fantastic infrastructure for extensions, and rather than imposing a lot of advanced functionality [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://radiantcms.org/">Radiant CMS</a> is a great content management system. It&#8217;s Rails, it&#8217;s simple &#8230; in fact it is so simple that you are bound to be missing some basic features once you start implementing your web site.</p>
<p>This is by design. Radiant has a fantastic infrastructure for extensions, and rather than imposing a lot of advanced functionality making the software harder to get started with for everyone, it lets each developer make his or her own choices.</p>
<p>Still, even with the <a href="http://ext.radiantcms.org/extensions">official extension registry</a> it can be hard to navigate the many extensions out there. Many people have asked me what I recommend for just getting basics such as reordering, image upload and menu generation. There is no final answer to that question, but this article covers 10 extensions that are compatible with the newest versions of Radiant and gives you functionality you can&#8217;t live without.</p>
<p><span id="more-168"></span></p>
<p><strong>For everyone</strong></p>
<ul>
<li><a href="http://github.com/radiant/radiant-reorder-extension/tree">Reorder</a>: Yes, you really need to install an extension to be able to change the order of your pages in the page tree. I think this will be built into Radiant 0.7 &#8211; hopefully!</li>
<li><a href="http://github.com/kbingman/paperclipped/tree">Paperclipped</a>: Currently the most popular extension for adding upload of images and other files. Great user interface &#8211; highly recommended.</li>
<li><a href="http://github.com/pilu/radiant-copy-move/tree/master">Copy/Move</a>: Once your website is live, you&#8217;ll often find the need to move or copy pages to other places in the page tree &#8211; this extension lets you do just that.</li>
<li><a href="http://github.com/derencius/navigation_tags/tree/master">Navigation tags</a>: There is a tag for generating the menu built into Radiant, but it requires you to hardcode the pages. This extension allows you to build your menu in a similar manner, but draws on the actual published pages in the page tree.</li>
</ul>
<p><strong>For the slightly larger website</strong></p>
<ul>
<li><a href="http://github.com/moklett/radiant-nested-layouts-extension/tree">Nested layouts</a>: This extension is a real gem if you ask me. It allows you to have a master layout with header, footer, main menu and so on, and then setup other layouts &#8220;nested&#8221; within the master with, say, a custom sidebar or headline shared by a bunch of pages.</li>
<li><a href="http://github.com/SwankInnovations/radiant-sns-extension/tree/master">Styles and scripts</a>: If you want to be able to change all aspects of your website without deploying new files, there is no way around this extension. It allows you to store stylesheets and javascripts separately from your pages, while still being able to update them in the admin interface.</li>
<li><a href="http://github.com/avonderluft/radiant-concurrent_draft-extension/tree/master">Concurrent draft</a>: Allows you to have one published version and one draft version of each page. That way you can work with changes to a page and preview them, without having to actually publish them for everyone to see.</li>
</ul>
<p><strong><br />
For those who build their own extensions</strong></p>
<ul>
<li><a href="http://github.com/radiant/radiant-share-layouts-extension/tree/master">Shared layouts</a>: If your extension includes pages that need to use the same layouts as the Radiant pages, this extension is a must. It simply lets you specify a Radiant layout in the controller just like you specify a Rails layout.</li>
<li><a href="http://github.com/digitalpulp/radiant-exception-notification-extension/tree">Exception notification</a>: Once you add your own extensions to Radiant it makes very much sense to be notified of any exceptions that occurs. This extension wraps the popular <a href="http://github.com/rails/exception_notification/tree/master">exception notification</a> plugin which has a few compatibility issues with Radiant.</li>
<li><a href="http://github.com/Squeegy/radiant-settings/tree">Settings</a>: I highly recommend that you let your own extensions be configurable through the standard <code>Radiant::Config</code> interface. This extension provides a tab in the admin interface for adding and editing these settings.</li>
</ul>
<p>Many, many more great extensions exists for Radiant &#8211; I haven&#8217;t even mentioned my own! And while the <a href="http://ext.radiantcms.org/extensions">official extension registry</a> is a great initiative, you&#8217;ll find even more by searching for <a href="http://github.com/search?type=Repositories&#038;q=radiant+extension">&#8220;radiant extension&#8221;</a> on Github.</p>
]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/01/25/10-extensions-for-radiant-cms-you-cant-live-without/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello Merb</title>
		<link>http://casperfabricius.com/site/2009/01/01/hello-merb/</link>
		<comments>http://casperfabricius.com/site/2009/01/01/hello-merb/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 15:46:32 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />
		<category><![CDATA[engines]]></category>
		<category><![CDATA[radiant]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[railsconf]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=158</guid>
		<description><![CDATA[Merb is getting merged into Ruby on Rails. Together they will become Rails 3, as announced by David Heinemeier Hansson here and Yehuda Katz here.
I wish I could claim to have been playing with Merb for a while and have some real insight into the framework, but to be honest, I haven&#8217;t. I still think [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.merbivore.org/">Merb</a> is getting merged into <a href="http://www.rubyonrails.com">Ruby on Rails</a>. Together they will become Rails 3, as announced by David Heinemeier Hansson <a href="http://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3">here</a> and Yehuda Katz <a href="http://yehudakatz.com/2008/12/23/rails-and-merb-merge/">here</a>.</p>
<p>I wish I could claim to have been playing with Merb for a while and have some real insight into the framework, but to be honest, I haven&#8217;t. I still think this a very interesting news, though, and in my opinion this can only be good news for the Rails community. Already, the brilliant Merb guys are optimizing and improving Rails, for instance <a href="http://yehudakatz.com/2008/12/27/status-memorandum/">this 8% speed boost in using <code>respond_to</code></a>.</p>
<p>So, how can we expect the the merge to affect the Rails framework we know and love? Let&#8217;s peek into the possibilities of combining these two frameworks.</p>
<p><span id="more-158"></span></p>
<p>One change that seems certain, is changes to the <b>routing system</b>. &#8220;Plans are already underway to port the Merb router over to Rails. At the very least, you will have the option to use the Merb DSL syntax instead of the Rails hash-based syntax. We’ll see which one becomes the default.&#8221; Katz <a href="http://yehudakatz.com/2008/12/29/another-rails-2x3-update/">says</a>. David <a href="http://www.loudthinking.com/posts/37-bringing-merbs-providesdisplay-into-rails-3">explains</a> how Merb concepts for rendering resources in different formats will be used in Rails 3, but with more intuitive or &#8220;Rails-like&#8221; naming.</p>
<p>Another change which is likely to make it into Rails 3 is <b>slices</b>, as indicated by Katz in a response to his own <a href="http://yehudakatz.com/2008/12/23/rails-and-merb-merge/">announcement</a>. Slices are &#8220;similar to what Rails-Engines promise, except merb-slices are built into the framework&#8221; as Ezra Zygmuntowicz <a href="http://brainspl.at/articles/2008/05/21/merb-slices">explains</a>. This is exiting news! I&#8217;ve always been interested gaining leverage by having reusable application slices, and I&#8217;ve actively built and used both <a href="http://rails-engines.org/">Rails Engines</a> and <a href="http://casperfabricius.com/site/2007/07/19/advanced-radiant-extensions/">Radiant extensions</a>. Engines has previously been frowned upon by leading figures in the Rails community, but it has been improved to work in a quite clean and easy-to-understand manner since the release of Rails 2.0, and are in fact compared to Merb slices <a href="http://rails-engines.org/news/2008/05/24/merb-slices-again/">here</a>. Radiant extensions are obviously only for Radiant CMS-based websites, but the <a href="http://ext.radiantcms.org/extensions">diversity</a> of these extensions illustrates the potential of getting support for real full-stack application slices into the Rails core. A project like <a href="https://github.com/svenfuchs/adva_cms/tree">Adva CMS</a> also illustrates how it is possible to build high quality reusable application slices for the common good.</p>
<p>A third change I hope to see as a result of the merge is <b>controller-based mailers and partials</b>. <code>ActionMailer</code> has always been a bit of an ugly stepchild in the Rails framework, and the positioning of a <code>Mailer</code> as a sort-of model, but with templates, doesn&#8217;t seem logic to me. Merb has an <code>AbstractController</code> class that both mailers and partials (called parts in Merb) inherit from, which allows for a more intuitive control in rendering mails and parts.</p>
<p>I was curious to find out how the Merb community has reacted to this decision. The Rails community doesn&#8217;t seem to be overly concerned. Perhaps it&#8217;s because the merge of Merb and Rails are called &#8220;Rails 3&#8243;. Not &#8220;Merb 2&#8243;, not &#8220;MerbRails&#8221; &#8211; the names clearly signals that the merge will be done on Rails&#8217; terms. While it has become popular in the Rails community to dissociate one self with David Heinemeier Hansson, I still think people sees him as a good security for not letting the Rails principles go in the merge.</p>
<p>I browsed through the more than 100 comments to <a href="http://yehudakatz.com/2008/12/23/rails-and-merb-merge/">Yehuda Katzs announcement</a> of the merge, and while about half of the commenters simply expresses their happiness and agreement with the decision, the objections of the other half falls roughly into three categories: Technical, personal and economic.</p>
<p>The <b>technical concerns</b> are of course fully expected, and some of the more interesting are:</p>
<ul>
<li>&#8220;Does merging a lightweight framework into a bloated framework make the bloated framework any lighter?&#8221;</li>
<li>&#8220;I really hope that merb will be able to continue it’s ‘no-magic’ attitude and bring that to rails without compromises&#8221;</li>
<li>&#8220;I would have liked to see merb go further on its own just to push the envelope further&#8221;</li>
<li>&#8220;How many planned advancements are being put on hold while Rails catches up?&#8221;</li>
</ul>
<p>The <b>personal objections</b> is about one very visible person: David Heinemeier Hansson. I hold no grudge against David, so I shall only repeat one of the more curious comments in this category: &#8220;The big problem, as always with Rails, is DHH: a vainglorious, two-faced prima donna with a massive and fragile ego. He’s good, but not nearly as unique and amazing as he thinks he is. I went to Merb to get away from DHH. Ugh.&#8221; If many people in the Merb community feels like this guy, I understand if they are concerned that David will simply steamroller the philosophy of Merb. David has been fast to <a href="http://www.loudthinking.com/posts/36-work-on-what-you-use-and-share-the-rest">address these concerns</a>, but the question is if just saying everyone should work on what the care about is enough.</p>
<p>The <b>economic perspective</b> of the merge is where things gets interesting. Rails is trademarked by David and synonymous with <a href="http://www.37signals.com">37signals</a>, while Merb is very closely linked to <a href="http://www.engineyard.com">EngineYard</a>. Two commenters really nail it down:</p>
<ul>
<li>&#8220;How has the ‘Opinionated Software’ philosophy of “Fuck You (DHH)” Rails become aligned with the ‘open’ and democratic philosophy of Merb? Is this some kind of preemptive marketing in advance of a joint investment in both Engine Yard and 37 Signals by a common investor?&#8221;</li>
<li>&#8220;My suspicion turns to the fact that almost every Merb core team member is owned by Engine Yard. Something doesn’t smell right.&#8221;</li>
</ul>
<p>It&#8217;ll be interesting to follow not just the architectural design choices made on the technical front during the merge process, but also how this will change the positioning of 37signals and EngineYard, and if the two companies are really warming up to some kind of close relationship.</p>
<p>The timeline for a first peek at Rails 3 &#8211; the union of Merb and Rails &#8211; is <a href="http://merbist.com/2008/12/23/rails-and-merb-merge/">said</a> to be RailsConf 2009 &#8211; 4 months from now.</p>
]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2009/01/01/hello-merb/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Removing Rails validations with metaprogramming</title>
		<link>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/</link>
		<comments>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/#comments</comments>
		<pubDate>Sat, 06 Dec 2008 14:10:05 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
		<br />
<b>Warning</b>:  Invalid argument supplied for foreach() in <b>/home/cfp/casperfabricius.com/site/wp-content/plugins/autometa/autometa.php</b> on line <b>324</b><br />
		<category><![CDATA[radiant]]></category>
		<category><![CDATA[rails]]></category>

	<!-- AutoMeta Start -->
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/site/?p=153</guid>
		<description><![CDATA[I recently found myself facing a metaprogramming challenge. I solved it by combining two terrible ugly hacks, and as such I won&#8217;t say I found a solution that is anywhere near to be elegant.
My problem was this: I was developing a Radiant extension called tags_multi_site, which allows the tags extension to play nice with the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently found myself facing a metaprogramming challenge. I solved it by combining two terrible ugly hacks, and as such I won&#8217;t say I found a solution that is anywhere near to be elegant.</p>
<p>My problem was this: I was developing a <a href="http://radiantcms.org">Radiant</a> extension called <a href="http://github.com/RSpace/radiant-tags_multi_site-extension/tree/master">tags_multi_site</a>, which allows the <a href="http://github.com/jomz/radiant-tags-extension/tree/master">tags extension</a> to play nice with the <a href="http://github.com/radiant/radiant-multi-site-extension/tree/master">multi_site extension</a>. This required me to scope all tags within a site, so that tags with the same name could exist in different sites, but in the same physical database table.</p>
<p>The tags extension has this validation:</p>
<pre class="cfcode">
class MetaTag < ActiveRecord::Base
  validates_uniqueness_of :name, :case_sensitive => false
end
</pre>
<p>I needed to add <code>:scope => :site_id</code>, but I couldn&#8217;t touch the code of tags extension itself, since that would terribly un-DRY and not reusable for anyone else. I had to either modify the existing validation programmatically from my own extension or to remove it and add my own.</p>
<p><span id="more-153"></span></p>
<p>I went for the last solution. I quickly discovered that validations are saved in an array available as an inheritable attribute on the model (<code>read_inheritable_attribute(:validate)</code>), and that the built-in Rails validation are stored as <code>Proc</code>s in this array. One could remove all validations added so far by emptying this array, but I only wanted to remove <code>validates_uniqueness_of</code> to stay as loosely coupled as possible.</p>
<p><code>Proc</code>s can&#8217;t tell much about themselves &#8211; they are mostly just there to be called. But I knew from the Rails code that each validation <code>Proc</code> is added from inside the class method of the validation. So, I just had to figure out a way to determine the method context the <code>Proc</code> had been declared in to be able to remove the right one.</p>
<p>I realized I could read variables from the <code>Proc</code>&#8217;s context by doing an <code>eval</code> with the <code>Proc</code>&#8217;s binding applied. I also found an expression somewhere that returned the name of current method by using the stacktrace information in <code>caller</code>.</p>
<p>All in all, the solution ended up like this:</p>
<pre class="cfcode">
module TagsMultiSite
  module MetaTagExtensions
    def self.included(base)
      base.extend(ClassMethods)
      base.class_eval {
        # HACK: Remove the existing validates_uniqueness_of block
        read_inheritable_attribute(:validate).reject! do |proc|
          if proc.is_a?(Proc)
            method = eval("caller[0] =~ /`([^']*)'/ and $1", proc.binding).to_sym rescue nil # Returns the name of method the proc was declared in
            :validates_uniqueness_of == method
          else
            false
          end
        end

        # Add new validates_uniqueness_of with correct scope
        validates_uniqueness_of :name, :case_sensitive => false, :scope => :site_id
      }
    end
  end
end
</pre>
<p>It would be easy to make this into a generalized method for removing Rails validations, but I think this issue is pretty rare. Usually people can just change or remove the original validation. Still, this example demonstrates fairly well how the trusting nature of Ruby allow us to make far-fetched metaprogramming hacks to solve our problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2008/12/06/removing-rails-validations-with-metaprogramming/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Writing a custom Radiant page type</title>
		<link>http://casperfabricius.com/site/2008/08/11/writing-a-custom-radiant-page-type/</link>
		<comments>http://casperfabricius.com/site/2008/08/11/writing-a-custom-radiant-page-type/#comments</comments>
		<pubDate>Mon, 11 Aug 2008 09:42:29 +0000</pubDate>
		<dc:creator>Casper Fabricius</dc:creator>
				<category><![CDATA[radiant]]></category>
		<category><![CDATA[rails]]></category>

	<!-- AutoMeta Start -->
	<category></category>
	<!-- AutoMeta End -->
	
		<guid isPermaLink="false">http://casperfabricius.com/blog/?p=67</guid>
		<description><![CDATA[I haven&#8217;t blogged much over the summer, but I have a fair number of excuses:

Vacation
When I have had the time to write, I have tried to prioritize my now almost finished master&#8217;s thesis
I got a lot of fun computer games and interesting books for my birthday
When I have had the time to write, but haven&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t blogged much over the summer, but I have a fair number of excuses:</p>
<ol>
<li>Vacation</li>
<li>When I have had the time to write, I have tried to prioritize my now almost finished master&#8217;s thesis</li>
<li>I got a lot of fun computer games and interesting books for my birthday</li>
<li>When I have had the time to write, but haven&#8217;t felt like writing on the thesis, I have felt I should prioritize the <a href="http://wiki.radiantcms.org/Summer_Reboot">Summer Reboot</a> documentation project for <a href="http://radiantcms.org/">Radiant</a>
</ol>
<p>Excuses aside, I think my latest contribution the the Radiant documentation base turned out quite good. It describes how to create a custom page type in Radiant in an extension, adding page tags, custom fields and other good stuff.</p>
<p><a href="http://wiki.radiantcms.org/Creating_an_extension_V">Check it out in the Radiant wiki</a>.</p>
<p>(I&#8217;m headed for RailsConf Europe in the beginning of September, and I hope a lot of articles will come out of that as usual &#8211; hope to see you there!)</p>
]]></content:encoded>
			<wfw:commentRss>http://casperfabricius.com/site/2008/08/11/writing-a-custom-radiant-page-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
