<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Jonathan Julian's Blog - Latest Comments</title><link xmlns="http://www.w3.org/2005/Atom" rel="http://api.friendfeed.com/2008/03#sup" href="http://disqus.com/sup/all.sup#forumcomments-2305e14c" type="application/json"/><link>http://jonathanjulian.disqus.com/</link><description></description><atom:link href="http://jonathanjulian.disqus.com/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 14 Dec 2011 05:36:51 -0000</lastBuildDate><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-386307685</link><description>Oops, I had a typo in my MyController pseudo code.  &lt;br&gt;&lt;br&gt;It should be this:&lt;br&gt;&lt;br&gt;class MyController &amp;lt; ApplicationControllerrespond_to :jsondef show@user = User.find(params[:id])&lt;br&gt; respond_with(@user , :include =&amp;gt; {:addresses =&amp;gt; {:include =&amp;gt; :email}})&lt;br&gt;end&lt;br&gt;&lt;br&gt;Which I want to refactor with something like this in the model:&lt;br&gt;def as_json(options={})super(:only =&amp;gt; [:email, :avatar], :include =&amp;gt;[:addresses =&amp;gt; {:include =&amp;gt; :email}])end&lt;br&gt;&lt;br&gt;But I get an &lt;br&gt;undefined method `macro' for nil:NilClass</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pseudo_rails</dc:creator><pubDate>Wed, 14 Dec 2011 05:36:51 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-386300580</link><description>Given the following example from your blog post:&lt;br&gt;&lt;br&gt;def as_json(options={})&lt;br&gt;  super(:only =&amp;gt; [:email, :avatar], :include =&amp;gt;[:addresses])&lt;br&gt;end&lt;br&gt;&lt;br&gt;when overriding the as_json method, if I want to include nested child nodes, how would I go about doing so?  I essentially want to refactor the respond_with usage in my controller by just overriding the as_json method in the model.&lt;br&gt;&lt;br&gt;class  MyController &amp;lt; ApplicationController&lt;br&gt;respond_to :json&lt;br&gt;def show&lt;br&gt;    @user = User.find(params[:id])&lt;br&gt;    respond_with(@tag, :include =&amp;gt; {:addresses =&amp;gt; {:include =&amp;gt; :email}})&lt;br&gt;end</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">pseudo_rails</dc:creator><pubDate>Wed, 14 Dec 2011 05:19:10 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-372318647</link><description>very helpful post, thanks</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">wcanyon</dc:creator><pubDate>Fri, 25 Nov 2011 16:51:30 -0000</pubDate></item><item><title>Re: Education Hack Day and my first iOS app</title><link>http://jonathanjulian.com/2011/11/education-hack-day-and-my-first-ios-app/#comment-364258272</link><description>Great detailed post, Jonathan. I wish I'd had your reserved nature at Start Up Weekend earlier this year. Sounds like you picked a fabulous team and I'm sure they were happy to have you. Congrats on the win &amp;amp; making through that learning curve!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Elizabeth Eadie</dc:creator><pubDate>Tue, 15 Nov 2011 23:57:12 -0000</pubDate></item><item><title>Re: Education Hack Day and my first iOS app</title><link>http://jonathanjulian.com/2011/11/education-hack-day-and-my-first-ios-app/#comment-363507839</link><description>Hack day photos:&lt;br&gt;&lt;br&gt;Day 1, Saturday&lt;br&gt;&lt;a href="https://www.facebook.com/media/set/?set=a.10150363440211097.348257.581151096&amp;amp;type=1&amp;amp;l=6140e7c8fd" rel="nofollow"&gt;https://www.facebook.com/media...&lt;/a&gt;&lt;br&gt;&lt;br&gt;Day 2, Sunday&lt;br&gt;&lt;a href="https://www.facebook.com/photo.php?fbid=10150366605211097&amp;amp;l=7993667db3" rel="nofollow"&gt;https://www.facebook.com/photo...&lt;/a&gt;&lt;br&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Michael</dc:creator><pubDate>Tue, 15 Nov 2011 06:53:44 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-318500180</link><description>Thanks. saved me.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bob</dc:creator><pubDate>Fri, 23 Sep 2011 14:15:34 -0000</pubDate></item><item><title>Re: Wrapping a div around will_paginate page_entries_info</title><link>http://jonathanjulian.com/2009/11/wrapping-a-div-around-will_paginate-page_entries_info/#comment-223969454</link><description>That initializer works for Rails 2.3.x - since you're on Rails 3, try a newer pagination gem: &lt;a href="https://github.com/amatsuda/kaminari" rel="nofollow"&gt;https://github.com/amatsuda/ka...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jjulian</dc:creator><pubDate>Sat, 11 Jun 2011 15:45:00 -0000</pubDate></item><item><title>Re: Wrapping a div around will_paginate page_entries_info</title><link>http://jonathanjulian.com/2009/11/wrapping-a-div-around-will_paginate-page_entries_info/#comment-216518514</link><description>Hmm.. I dropped that into config/initializers/will_paginate.rb and I now get "undefined method `page_entries_info' for module `WillPaginate::ViewHelpers'" when I attempt to start rails.  So, it seems to be attempting to process this file before it loads the will_paginate gem (Rails 3.0.7).</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">JS</dc:creator><pubDate>Thu, 02 Jun 2011 11:23:15 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-208807952</link><description>Also check out rabl as well: &lt;a href="https://github.com/nesquena/rabl" rel="nofollow"&gt;https://github.com/nesquena/ra...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nathan Esquenazi</dc:creator><pubDate>Sat, 21 May 2011 07:58:23 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-208806797</link><description>Check out &lt;a href="http://engineering.gomiso.com/2011/05/16/if-youre-using-to_json-youre-doing-it-wrong/" rel="nofollow"&gt;http://engineering.gomiso.com/...&lt;/a&gt; We agree 100% and found a better way. to_json / as_json is rarely the right way to go about this.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nathan Esquenazi</dc:creator><pubDate>Sat, 21 May 2011 07:57:15 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-192034787</link><description>I experience a huge performance hit, if I override as_json in the model rather than using it directly. Can anybody confirm this? If so, what coul be the reason?&lt;br&gt;Thanks&lt;br&gt;Rene</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rene</dc:creator><pubDate>Tue, 26 Apr 2011 10:03:58 -0000</pubDate></item><item><title>Re: My favorite parts of RubyNation 2011</title><link>http://jonathanjulian.com/2011/04/my-favorite-parts-of-rubynation-2011/#comment-178086192</link><description>I did not enjoy the miniburgers.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">bryanl</dc:creator><pubDate>Mon, 04 Apr 2011 14:38:28 -0000</pubDate></item><item><title>Re: My favorite parts of RubyNation 2011</title><link>http://jonathanjulian.com/2011/04/my-favorite-parts-of-rubynation-2011/#comment-177622292</link><description>Thanks for the post, Jonathan. I wish I had been able to go.&lt;br&gt;&lt;br&gt;I really appreciate the links to the slides--it makes it so much faster to get caught up on what happened at the conference.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Scott Messinger</dc:creator><pubDate>Sun, 03 Apr 2011 22:23:49 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-169375092</link><description>Any ideas on this issue: &lt;a href="http://stackoverflow.com/questions/4840968/as-json-not-calling-as-json-on-associations" rel="nofollow"&gt;http://stackoverflow.com/quest...&lt;/a&gt;&lt;br&gt;&lt;br&gt;?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Dan Hixon</dc:creator><pubDate>Mon, 21 Mar 2011 23:49:00 -0000</pubDate></item><item><title>Re: Testing SNMP traps with snmptrapd</title><link>http://jonathanjulian.com/2008/07/testing-snmp-traps-with-snmptrapd/#comment-158250968</link><description>Thanks Jonathan, for this post. Your post help me out.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ashutosh gGsain</dc:creator><pubDate>Tue, 01 Mar 2011 08:47:12 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-148449080</link><description>Hi Jonathan,&lt;br&gt;&lt;br&gt;Great blog post. I am not able to use as_json with :include very well. I have posted a questions at &lt;a href="http://stackoverflow.com/questions/5000870/defaults-for-to-json-in-rails-with-include" rel="nofollow"&gt;http://stackoverflow.com/quest...&lt;/a&gt; (please ignore the comment there about acts_as_api).&lt;br&gt;&lt;br&gt;Would appreciate it if you can take a look at it.&lt;br&gt;&lt;br&gt;Thanks,&lt;br&gt;Prateek</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Prateek Dayal</dc:creator><pubDate>Wed, 16 Feb 2011 05:26:38 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-87098615</link><description>As mentioned above, "Watch out for a bug in Rails 3.0". I haven't found it reported yet.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jjulian</dc:creator><pubDate>Fri, 15 Oct 2010 00:10:19 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-86220811</link><description>Can you confirm this works with rails3?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Stewart</dc:creator><pubDate>Tue, 12 Oct 2010 08:00:07 -0000</pubDate></item><item><title>Re: Proof that I was at JSConf 2010: Hangover.js</title><link>http://jonathanjulian.com/2010/06/proof-that-i-was-at-jsconf-2010-hangover-js/#comment-85579844</link><description>I enjoyed watching the presentation video.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jlugocp</dc:creator><pubDate>Sat, 09 Oct 2010 18:21:48 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-75743832</link><description>Good description. Watch out for a bug in Rails 3.0 tho. Calling super from as_json won't work. Read more &lt;a href="http://blog.ternarylabs.com/2010/09/07/migrating-to-rails-3-0-gotchas-as_json-bug/" rel="nofollow"&gt;http://blog.ternarylabs.com/20...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Georges Auberger</dc:creator><pubDate>Tue, 07 Sep 2010 11:57:54 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-70218198</link><description>How would you make this better?  If it's truly going to be a view than you will return everything from as_json and create the object you need in the client side code.  So then you can just make as_json skip any attributes you will never need. Do you have a better way to do this?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Tony Amoyal</dc:creator><pubDate>Fri, 20 Aug 2010 10:57:53 -0000</pubDate></item><item><title>Re: Five Tips to Improve Your Ext JS Application</title><link>http://jonathanjulian.com/2010/01/five-tips-to-improve-your-ext-js-application/#comment-62299759</link><description>I have watched the video and it helped me a lot in integrating the Event manager in my applications. For I had missed this part completely. Thank you. Good advice and I have great results.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Johan van de Merwe</dc:creator><pubDate>Wed, 14 Jul 2010 20:17:27 -0000</pubDate></item><item><title>Re: rake jslint</title><link>http://jonathanjulian.com/2009/07/rake-jslint/#comment-61335047</link><description>Even better, this guy has bundled it up into a Rails plugin and has made passing options to JSLint possible through a .yml configuration file! &lt;a href="http://lunarlogicpolska.com/blog/2010/03/29/check-your-scripts-with-jslint-on-rails.html" rel="nofollow"&gt;http://lunarlogicpolska.com/bl...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">webandy</dc:creator><pubDate>Fri, 09 Jul 2010 15:57:17 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-56763531</link><description>What as I don't like about this is that as_json to me is like a view, and should not belong in my model. The options hash only leads to more unnecessary if-then-else branches.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Lawrence Pit</dc:creator><pubDate>Mon, 14 Jun 2010 22:16:24 -0000</pubDate></item><item><title>Re: Rails to_json or as_json?</title><link>http://jonathanjulian.com/2010/04/rails-to_json-or-as_json/#comment-56244461</link><description>Try @people.first.as_json. The options passed to as_json only take :only and :except.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">jjulian</dc:creator><pubDate>Fri, 11 Jun 2010 17:02:54 -0000</pubDate></item></channel></rss>
