<?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: Dear Railsists, Please Don&#8217;t be Obtrusive</title>
	<atom:link href="http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/</link>
	<description>Experiences with Ruby and Rails, Web2.0 and other development technologies</description>
	<pubDate>Fri, 10 Sep 2010 15:49:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Darío</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-2/#comment-149142</link>
		<dc:creator>Darío</dc:creator>
		<pubDate>Tue, 07 Sep 2010 22:30:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-149142</guid>
		<description>&lt;p&gt;Dear Peter,&lt;/p&gt;

&lt;p&gt;I share the thoughts and concerns of creating views that are not obstructed by any code, especially JavaScript, at all. I have been applying the techniques you describe here for a long while and can give my testimony that they get their job done!&lt;/p&gt;

&lt;p&gt;Now the only problem I am seeing in this code is the lack of flexibility towards non-JavaScript enabled browsers. What if someone tries to reach your code without JavaScript? Let's put it into a more realistic world: what if you are specifying an API?&lt;/p&gt;

&lt;p&gt;In my opinion your code could use some header detection to determine whether the client wants a JSON answer (e.g. if it is an AJAX client), html (e.g. a simple post done by a form that informs your data was submitted properly), etc. Luckily, and as you may already be aware of, this could be achieved by using the respond_to provided in rails as follows:&lt;/p&gt;

&lt;p&gt;def create
   @message = Message.create(:author =&#62; params[:author], :message =&#62; params[:message])
   respond_to do &#124;format&#124;
     format.json {render :partial =&#62; 'message', :object =&#62; @message}
     format.html
   end
 end&lt;/p&gt;

&lt;p&gt;Even though I particularly dislike sending raw html through a JSON request -I think it should be a proper JSON object- this is a better approach to handle both kinds of requests nicely.&lt;/p&gt;

&lt;p&gt;I understand the purpose of the example was to prove how unobstrusive JavaScript coding can be done. However, we should not forget that a similar concept should be bore in mind when defining the endpoints of our applications.&lt;/p&gt;

&lt;p&gt;Regards,
Darío&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Dear Peter,</p>
<p>I share the thoughts and concerns of creating views that are not obstructed by any code, especially JavaScript, at all. I have been applying the techniques you describe here for a long while and can give my testimony that they get their job done!</p>
<p>Now the only problem I am seeing in this code is the lack of flexibility towards non-JavaScript enabled browsers. What if someone tries to reach your code without JavaScript? Let&#8217;s put it into a more realistic world: what if you are specifying an API?</p>
<p>In my opinion your code could use some header detection to determine whether the client wants a JSON answer (e.g. if it is an AJAX client), html (e.g. a simple post done by a form that informs your data was submitted properly), etc. Luckily, and as you may already be aware of, this could be achieved by using the respond_to provided in rails as follows:</p>
<p>def create<br />
   @message = Message.create(:author =&gt; params[:author], :message =&gt; params[:message])<br />
   respond_to do |format|<br />
     format.json {render :partial =&gt; &#8216;message&#8217;, :object =&gt; @message}<br />
     format.html<br />
   end<br />
 end</p>
<p>Even though I particularly dislike sending raw html through a JSON request -I think it should be a proper JSON object- this is a better approach to handle both kinds of requests nicely.</p>
<p>I understand the purpose of the example was to prove how unobstrusive JavaScript coding can be done. However, we should not forget that a similar concept should be bore in mind when defining the endpoints of our applications.</p>
<p>Regards,<br />
Darío</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: target48</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-1/#comment-142526</link>
		<dc:creator>target48</dc:creator>
		<pubDate>Tue, 18 May 2010 21:28:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-142526</guid>
		<description>&lt;p&gt;Не поспоришь, отменная новость&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Не поспоришь, отменная новость</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mary</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-1/#comment-142525</link>
		<dc:creator>Mary</dc:creator>
		<pubDate>Tue, 18 May 2010 19:29:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-142525</guid>
		<description>&lt;p&gt;Не спорю, грамотная статья&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Не спорю, грамотная статья</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: twcbyvxl</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-1/#comment-142477</link>
		<dc:creator>twcbyvxl</dc:creator>
		<pubDate>Mon, 17 May 2010 19:55:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-142477</guid>
		<description>&lt;p&gt;В принципе, вебмастер оригинально накропал.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>В принципе, вебмастер оригинально накропал.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Senator</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-1/#comment-142468</link>
		<dc:creator>Senator</dc:creator>
		<pubDate>Mon, 17 May 2010 15:01:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-142468</guid>
		<description>&lt;p&gt;Как обычно, написавший кошерно накреативил!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Как обычно, написавший кошерно накреативил!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Георгий Шумилов</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-1/#comment-137704</link>
		<dc:creator>Георгий Шумилов</dc:creator>
		<pubDate>Thu, 22 Oct 2009 08:46:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-137704</guid>
		<description>&lt;p&gt;Очень понравился ваш сайт, спасибо. Удачи.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Очень понравился ваш сайт, спасибо. Удачи.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Виссарион Андреев</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-1/#comment-137699</link>
		<dc:creator>Виссарион Андреев</dc:creator>
		<pubDate>Thu, 22 Oct 2009 05:59:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-137699</guid>
		<description>&lt;p&gt;ребята – не бросайте сайт, приятно читать&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>ребята – не бросайте сайт, приятно читать</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Виталий Ракутин</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-1/#comment-135168</link>
		<dc:creator>Виталий Ракутин</dc:creator>
		<pubDate>Fri, 21 Aug 2009 10:40:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-135168</guid>
		<description>&lt;p&gt;спасибо, прочитал на одном дыхании&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>спасибо, прочитал на одном дыхании</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Андрей Краснов</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-1/#comment-135159</link>
		<dc:creator>Андрей Краснов</dc:creator>
		<pubDate>Fri, 21 Aug 2009 01:53:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-135159</guid>
		<description>&lt;p&gt;Добротно сделано, контент порадовал, сам на многие блоги и не зашёл бы никогда…&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Добротно сделано, контент порадовал, сам на многие блоги и не зашёл бы никогда…</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Владимир Осокин</title>
		<link>http://www.rubyrailways.com/dear-railsists-please-dont-be-obtrusive/comment-page-1/#comment-133343</link>
		<dc:creator>Владимир Осокин</dc:creator>
		<pubDate>Tue, 07 Jul 2009 13:31:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.rubyrailways.com/?p=437#comment-133343</guid>
		<description>&lt;p&gt;Хм… Но, как говорят, а воз и ныне там&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Хм… Но, как говорят, а воз и ныне там</p>
]]></content:encoded>
	</item>
</channel>
</rss>
