<?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>Cognizant Transmutaion &#187; Ruby</title>
	<atom:link href="http://blog.ibd.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ibd.com</link>
	<description>Internet Bandwidth Development: Composting the Internet for over Two Decades</description>
	<lastBuildDate>Fri, 18 Jun 2010 02:00:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Nice jruby installation cookbook (Opscode)</title>
		<link>http://blog.ibd.com/sysadmin/nice-jruby-installation-cookbook-opscode/</link>
		<comments>http://blog.ibd.com/sysadmin/nice-jruby-installation-cookbook-opscode/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 03:04:01 +0000</pubDate>
		<dc:creator>Robert J Berger</dc:creator>
				<category><![CDATA[Opscode Chef]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.ibd.com/?p=546</guid>
		<description><![CDATA[<p>There are a lot of good example Opscode cookbooks out there. Unfortunately they can be hard to find. People are not submitting them to the Opscode Cookbook repository. Its still hard to untangle your own cookbooks into something that can be put in a sharable format I guess.</p>
<p>Right now, the most productive way to find cookbooks [...]]]></description>
			<content:encoded><![CDATA[<p>There are a lot of good example Opscode cookbooks out there. Unfortunately they can be hard to find. People are not submitting them to the Opscode Cookbook repository. Its still hard to untangle your own cookbooks into something that can be put in a sharable format I guess.</p>
<p>Right now, the most productive way to find cookbooks seems to be to search github. I always do a search before I write my own. Google searches are tough since &#8220;chef&#8221;, &#8220;cookbooks&#8221; are overloaded from the &#8220;real cooking&#8221; domain. And if you put in some package name, you tend to get announcements about the package and a mention about Opscode, but rarely about an Opscode Cookbook for that package.</p>
<p>Today I discovered that I needed a cookbook to install jruby. So after a useless Google Search. I did a search &#8220;jruby cookbook&#8221; on github and soon found <a href="http://github.com/theoooo" target="_blank">Theo Cushion</a>&#8216;s <a href="http://github.com/theoooo/cookbooks/tree/master/jruby/" target="_blank">cookbook clone with a jruby addition</a>.</p>
<p>Its better to not have to write it yourself! My thanks to Theo and the many others who share their code.</p>
<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.ibd.com/sysadmin/nice-jruby-installation-cookbook-opscode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cross Domain RESTful AJAX with jQuery and Rails 2.2.2</title>
		<link>http://blog.ibd.com/ruby-rails/cross-domain-restful-ajax-with-jquery-and-rails-222/</link>
		<comments>http://blog.ibd.com/ruby-rails/cross-domain-restful-ajax-with-jquery-and-rails-222/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 07:32:10 +0000</pubDate>
		<dc:creator>Robert J Berger</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Ruby / Rails]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[monkey patch]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://blog.ibd.com/?p=156</guid>
		<description><![CDATA[<p>Flinn Mueller aka actsasflinn wrote an blog post Cross domain RESTful JSON-P with Rails back in July. There he showed how to monkeypatch Rails to allow json-p to do all the REST verbs even when going across domains. He also showed how to make the json-p calls with jquery. A very nice solution that we take [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.actsasflinn.com" target="_blank">Flinn Mueller aka actsasflinn</a> wrote an blog post <a href="http://www.actsasflinn.com/2008/06/13/cross-domain-restful-json-p-with-rails" target="_blank">Cross domain RESTful JSON-P with Rails</a> back in July. There he showed how to monkeypatch Rails to allow json-p to do all the REST verbs even when going across domains. He also showed how to make the json-p calls with jquery. A very nice solution that we take advantage of in one of our apps. The only problem we had was that it stopped working when we upgraded to Rails 2.2.2.</p>
<p>There are other issues using this technique. To quote Flinn:</p>
<blockquote><p>Achtung! Monkey patching with the above will expose your create method without using an actual post. Imho no big deal, others might be more cautious (<a href="http://actsasflinn.com/articles/2008/04/27/captcha-sucks">CAPTCHA</a>is always an option), ymmv.</p></blockquote>
<p>See his original article for details on how to use it generally. </p>
<p>The problem with the monkeypatch that he wrote up is that Rails 2.2.2 changed the function that was monkeypatched so the patch stopped working. Below is code that will work on both pre and post 2.2.2 Rails:</p>
<pre>
<pre>
<span>module</span> ActionController
<span>  class</span> AbstractRequest

<span>    </span><span>def</span> request_method

<span>      if</span> Rails::VERSION::STRING &lt;<span> "2.2.2"</span>

<span>        <span>@request_method</span><span> ||=</span><span> begin</span></span>

<span>          method = (parameters[<span>:_method</span>].blank? ?<span> </span><span>@env</span>[<span>'REQUEST_METHOD'</span>] : parameters[<span>:_method</span>].to_s).<span>downcase</span></span>

<span><span>          if</span> ACCEPTED_HTTP_METHODS.include?(method)</span>

            method.to_sym

          else

            raise UnknownHttpMethod,<span> "#{</span>method<span>}, accepted HTTP methods are #{</span>ACCEPTED_HTTP_METHODS.to_a.to_sentence<span>}"</span>

<span>          end</span>

        end

      else

        method =<span> </span><span>@env</span>[<span>'REQUEST_METHOD'</span>]

        method = parameters[<span>:_method</span>]<span> unless</span> parameters[<span>:_method</span>].blank?

        HTTP_METHOD_LOOKUP[method] || raise(UnknownHttpMethod,<span> "#{</span>method<span>}, accepted HTTP methods are #{</span>HTTP_METHODS.to_sentence<span>}"</span>)
      end

    end

  end
end</pre>
</pre>
<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.ibd.com/ruby-rails/cross-domain-restful-ajax-with-jquery-and-rails-222/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>QuarkRuby: Consume non rails-style REST APIs</title>
		<link>http://blog.ibd.com/ruby-rails/quarkruby-consume-non-rails-style-rest-apis/</link>
		<comments>http://blog.ibd.com/ruby-rails/quarkruby-consume-non-rails-style-rest-apis/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 01:09:41 +0000</pubDate>
		<dc:creator>Robert J Berger</dc:creator>
				<category><![CDATA[Ruby / Rails]]></category>
		<category><![CDATA[APIs]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://blog.ibd.com/?p=87</guid>
		<description><![CDATA[<p>It seems that most &#8220;RESTful&#8221; APIs in the wild are well, pretty wild. They don&#8217;t meet the strict requirements of the pure CRUD/REST of ActiveResource.</p>
<p>The article in QuarkRuby:  Consume non rails-style REST APIs shows how to create a nice ruby wrapper around ActiveResource so you can adapt to any arbitrary REST / http interface on [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that most &#8220;RESTful&#8221; APIs in the wild are well, pretty wild. They don&#8217;t meet the strict requirements of the pure CRUD/REST of ActiveResource.</p>
<p>The article in <a href="http://www.quarkruby.com">QuarkRuby</a>:  <a href="http://www.quarkruby.com/2008/3/11/consume-non-rails-style-rest-apis">Consume non rails-style REST APIs</a> shows how to create a nice ruby wrapper around ActiveResource so you can adapt to any arbitrary REST / http interface on the Internet.</p>
<div style='clear:both'></div>]]></content:encoded>
			<wfw:commentRss>http://blog.ibd.com/ruby-rails/quarkruby-consume-non-rails-style-rest-apis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
