<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Rails 2.1 and Incoming JSON Requests</title>
	<atom:link href="http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/</link>
	<description>Thoughts from the Hobbit Hole</description>
	<lastBuildDate>Thu, 09 Sep 2010 16:46:08 -0700</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: DigitalHobbit</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-174995</link>
		<dc:creator>DigitalHobbit</dc:creator>
		<pubDate>Tue, 26 Jan 2010 05:06:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-174995</guid>
		<description>&lt;p&gt;Nik, are you writing a Ruby script or a shell script? If you&#039;re using Ruby, why not just use Net::HTTP instead of shelling out to curl?&lt;/p&gt;

&lt;p&gt;By itself, neither of these solutions will keep track of the logged in user. If you really need this, you probably need to implement cookies, as these are necessary to keep track of the user session. Otherwise, you may be able to get away with including the basic auth credentials in each request.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Nik, are you writing a Ruby script or a shell script? If you&#8217;re using Ruby, why not just use Net::HTTP instead of shelling out to curl?</p>

<p>By itself, neither of these solutions will keep track of the logged in user. If you really need this, you probably need to implement cookies, as these are necessary to keep track of the user session. Otherwise, you may be able to get away with including the basic auth credentials in each request.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Nik</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-174907</link>
		<dc:creator>Nik</dc:creator>
		<pubDate>Mon, 25 Jan 2010 22:48:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-174907</guid>
		<description>&lt;p&gt;This is very useful indeed, I have a related question if you&#039;d be kind enough to point me to the right direction in answering it that&#039;d be great.&lt;/p&gt;

&lt;p&gt;I am trying to write a script that uses curl to post data to a tiny webapp that uses authlogic to provide the username/password protection. Does curl support that? I mean, I am guessing one can do a post with username and password (in raw text?) to login, but will curl and rails &quot;remember&quot; that it has been logged in? or do I have to supply username and password for each request that I do?&lt;/p&gt;

&lt;p&gt;Thank You!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This is very useful indeed, I have a related question if you&#8217;d be kind enough to point me to the right direction in answering it that&#8217;d be great.</p>

<p>I am trying to write a script that uses curl to post data to a tiny webapp that uses authlogic to provide the username/password protection. Does curl support that? I mean, I am guessing one can do a post with username and password (in raw text?) to login, but will curl and rails &#8220;remember&#8221; that it has been logged in? or do I have to supply username and password for each request that I do?</p>

<p>Thank You!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-141470</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Thu, 20 Aug 2009 03:45:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-141470</guid>
		<description>&lt;p&gt;Just wanted to leave a note that I think the test can be better written as:&lt;/p&gt;

&lt;p&gt;def test_create_via_json
  assert_difference(&#039;Book.count&#039;) do
    post :create, :book =&gt; { :title =&gt; &quot;Posted via JSON&quot;, :author =&gt; &quot;Jason Bourne&quot;, :isbn =&gt; &quot;1234567890, :price =&gt; 49.95}, :format =&gt; :json
  end
end&lt;/p&gt;

&lt;p&gt;That makes the test agnostic of the format so you could easily do an enumeration of multiple post format&#039;s (i.e. [:json, :html].each do &#124;format&#124; ... :format =&gt; format}) and not have to change the test.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Just wanted to leave a note that I think the test can be better written as:</p>

<p>def test_create_via_json
  assert_difference(&#8217;Book.count&#8217;) do
    post :create, :book =&gt; { :title =&gt; &#8220;Posted via JSON&#8221;, :author =&gt; &#8220;Jason Bourne&#8221;, :isbn =&gt; &#8220;1234567890, :price =&gt; 49.95}, :format =&gt; :json
  end
end</p>

<p>That makes the test agnostic of the format so you could easily do an enumeration of multiple post format&#8217;s (i.e. [:json, :html].each do |format| &#8230; :format =&gt; format}) and not have to change the test.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: DigitalHobbit</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-105117</link>
		<dc:creator>DigitalHobbit</dc:creator>
		<pubDate>Thu, 12 Mar 2009 04:33:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-105117</guid>
		<description>&lt;p&gt;Hey Steve, glad to hear you got ActionWebService working!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey Steve, glad to hear you got ActionWebService working!</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-104828</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Wed, 11 Mar 2009 02:14:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-104828</guid>
		<description>&lt;p&gt;Well for what it&#039;s worth, I got ActionWebService working today.  It was actually relatively painless, although I wish it had better documentation.  Maybe I&#039;ll add something to their Wiki on Github once I&#039;m done implementing...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Well for what it&#8217;s worth, I got ActionWebService working today.  It was actually relatively painless, although I wish it had better documentation.  Maybe I&#8217;ll add something to their Wiki on Github once I&#8217;m done implementing&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-104735</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 10 Mar 2009 17:50:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-104735</guid>
		<description>&lt;p&gt;Interesting...  my searches eventually turned up:
http://blog.multiplay.co.uk/2008/10/serving-xml-rpc-from-rails-2x
But I can&#039;t tell if this is a gem/plugin or included with Rails 2.x (as the comment seems to imply)...&lt;/p&gt;

&lt;p&gt;What do you make of this xmlrpc4r?
http://www.fantasy-coders.de/ruby/xmlrpc4r/&lt;/p&gt;

&lt;p&gt;I swear, this is my last question on this particular post.  I don&#039;t want to impose on your hobbit hospitality...  ;)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Interesting&#8230;  my searches eventually turned up:
<a href="http://blog.multiplay.co.uk/2008/10/serving-xml-rpc-from-rails-2x" rel="nofollow">http://blog.multiplay.co.uk/2008/10/serving-xml-rpc-from-rails-2x</a>
But I can&#8217;t tell if this is a gem/plugin or included with Rails 2.x (as the comment seems to imply)&#8230;</p>

<p>What do you make of this xmlrpc4r?
<a href="http://www.fantasy-coders.de/ruby/xmlrpc4r/" rel="nofollow">http://www.fantasy-coders.de/ruby/xmlrpc4r/</a></p>

<p>I swear, this is my last question on this particular post.  I don&#8217;t want to impose on your hobbit hospitality&#8230;  <img src='http://www.digitalhobbit.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>]]></content:encoded>
	</item>
	<item>
		<title>By: DigitalHobbit</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-104583</link>
		<dc:creator>DigitalHobbit</dc:creator>
		<pubDate>Tue, 10 Mar 2009 04:28:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-104583</guid>
		<description>&lt;p&gt;@Steve:&lt;/p&gt;

&lt;p&gt;Glad you&#039;re enjoying Rails. :)&lt;/p&gt;

&lt;p&gt;Regarding XML-RPC: I never had to implement this myself in Rails, and the Rails community&#039;s focus has definitely been on REST. ActionWebservice used to provide this functionality but was discontinued. However, it looks like someone created a fork on GitHub that works with Rails 2.1 and 2.2, supports both XML-RPC and SOAP, and includes various improvements.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://github.com/datanoise/actionwebservice/tree/master&quot; rel=&quot;nofollow&quot;&gt;ActionWebservice on Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.datanoise.com/articles/2008/7/2/actionwebservice-is-back&quot; rel=&quot;nofollow&quot;&gt;Blog post announcing the release&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hope this works for you.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@Steve:</p>

<p>Glad you&#8217;re enjoying Rails. <img src='http://www.digitalhobbit.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

<p>Regarding XML-RPC: I never had to implement this myself in Rails, and the Rails community&#8217;s focus has definitely been on REST. ActionWebservice used to provide this functionality but was discontinued. However, it looks like someone created a fork on GitHub that works with Rails 2.1 and 2.2, supports both XML-RPC and SOAP, and includes various improvements.</p>

<p><a href="http://github.com/datanoise/actionwebservice/tree/master" rel="nofollow">ActionWebservice on Github</a></p>

<p><a href="http://www.datanoise.com/articles/2008/7/2/actionwebservice-is-back" rel="nofollow">Blog post announcing the release</a></p>

<p>Hope this works for you.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-104558</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 10 Mar 2009 02:32:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-104558</guid>
		<description>&lt;p&gt;OK this is only tangentially related, and I&#039;m sorry to ask here, but dang if I couldn&#039;t find any other blog post that seemed appropriate...&lt;/p&gt;

&lt;p&gt;Can you point me to some doc(s) about creating an XMLRPC server in Rails?  Seems like it should be a fairly basic task, but my numerous google searches turned up nothing recent or useful...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>OK this is only tangentially related, and I&#8217;m sorry to ask here, but dang if I couldn&#8217;t find any other blog post that seemed appropriate&#8230;</p>

<p>Can you point me to some doc(s) about creating an XMLRPC server in Rails?  Seems like it should be a fairly basic task, but my numerous google searches turned up nothing recent or useful&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-104546</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Tue, 10 Mar 2009 01:28:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-104546</guid>
		<description>&lt;p&gt;This... is... freaking... awesome!!!  Thank you Mr DigitalHobbit  :D&lt;/p&gt;

&lt;p&gt;Ruby on Rails is great...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>This&#8230; is&#8230; freaking&#8230; awesome!!!  Thank you Mr DigitalHobbit  <img src='http://www.digitalhobbit.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>

<p>Ruby on Rails is great&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: DigitalHobbit</title>
		<link>http://www.digitalhobbit.com/2008/05/25/rails-21-and-incoming-json-requests/comment-page-1/#comment-96758</link>
		<dc:creator>DigitalHobbit</dc:creator>
		<pubDate>Thu, 19 Feb 2009 00:36:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.digitalhobbit.com/?p=295#comment-96758</guid>
		<description>&lt;p&gt;Steve, check out the &lt;a href=&quot;http://api.rubyonrails.org/classes/ActiveRecord/Serialization.html&quot; rel=&quot;nofollow&quot;&gt;serialization docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You should be able to do something like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
format.json { render :json =&gt; @book.to_json(:except =&gt; [:created_at, :updated_at]) }
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Or the other way round, using :only:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
format.json { render :json =&gt; @book.to_json(:only =&gt; [:author, :title]) }
&lt;/code&gt;&lt;code&gt;&lt;/p&gt;

&lt;p&gt;Alternatively, you could override to_json in your Book model and have it exclude / include the necessary attributes. This may be preferable if you&#039;re rendering books to json in multiple places and don&#039;t want to duplicate the same :only / :except options everywhere.&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Steve, check out the <a href="http://api.rubyonrails.org/classes/ActiveRecord/Serialization.html" rel="nofollow">serialization docs</a>.</p>

<p>You should be able to do something like this:</p>

<p><code>
format.json { render :json => @book.to_json(:except => [:created_at, :updated_at]) }
</code></p>

<p>Or the other way round, using <img src='http://www.digitalhobbit.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly:</p>

<p><code>
format.json { render :json => @book.to_json(:only => [:author, :title]) }
</code><code></code></p>

<p>Alternatively, you could override to_json in your Book model and have it exclude / include the necessary attributes. This may be preferable if you're rendering books to json in multiple places and don't want to duplicate the same <img src='http://www.digitalhobbit.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly / :except options everywhere.</p>]]></content:encoded>
	</item>
</channel>
</rss>
