<?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>Fri, 04 May 2012 13:52:36 -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-519262570</link><description>&lt;p&gt;Great post jjulian!&lt;/p&gt;

&lt;p&gt;any chance you can help with &lt;a href="http://stackoverflow.com/questions/10433194/rails-format-json" rel="nofollow"&gt;http://stackoverflow.com/quest...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rafael Revi</dc:creator><pubDate>Fri, 04 May 2012 13:52:36 -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-458669385</link><description>&lt;p&gt;So helpful! thanks. Didn't know about as_json before.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Magnemg</dc:creator><pubDate>Wed, 07 Mar 2012 07:58:47 -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-386307685</link><description>&lt;p&gt;Oops, I had a typo in my MyController pseudo code.  &lt;/p&gt;

&lt;p&gt;It should be this:&lt;/p&gt;

&lt;p&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;/p&gt;

&lt;p&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;/p&gt;

&lt;p&gt;But I get an &lt;br&gt;undefined method `macro' for nil:NilClass&lt;/p&gt;</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>&lt;p&gt;Given the following example from your blog post:&lt;/p&gt;

&lt;p&gt;def as_json(options={})&lt;br&gt;  super(:only =&amp;gt; [:email, :avatar], :include =&amp;gt;[:addresses])&lt;br&gt;end&lt;/p&gt;

&lt;p&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;/p&gt;

&lt;p&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&lt;/p&gt;</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>&lt;p&gt;very helpful post, thanks &lt;/p&gt;</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>&lt;p&gt;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!&lt;/p&gt;</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>&lt;p&gt;Hack day photos:&lt;/p&gt;

&lt;p&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;/p&gt;

&lt;p&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;&lt;/p&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>&lt;p&gt;Thanks. saved me.&lt;/p&gt;</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>&lt;p&gt;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;&lt;/p&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>&lt;p&gt;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).&lt;/p&gt;</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>&lt;p&gt;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;&lt;/p&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>&lt;p&gt;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.&lt;/p&gt;</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>&lt;p&gt;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&lt;/p&gt;</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>&lt;p&gt;I did not enjoy the miniburgers.&lt;/p&gt;</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>&lt;p&gt;Thanks for the post, Jonathan. I wish I had been able to go.&lt;/p&gt;

&lt;p&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.&lt;/p&gt;</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>&lt;p&gt;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;/p&gt;

&lt;p&gt;?&lt;/p&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>&lt;p&gt;Thanks Jonathan, for this post. Your post help me out.&lt;/p&gt;</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>&lt;p&gt;Hi Jonathan,&lt;/p&gt;

&lt;p&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;/p&gt;

&lt;p&gt;Would appreciate it if you can take a look at it.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br&gt;Prateek&lt;/p&gt;</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>&lt;p&gt;As mentioned above, "Watch out for a bug in Rails 3.0". I haven't found it reported yet.&lt;/p&gt;</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>&lt;p&gt;Can you confirm this works with rails3?&lt;/p&gt;</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>&lt;p&gt;I enjoyed watching the presentation video.&lt;/p&gt;</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>&lt;p&gt;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;&lt;/p&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>&lt;p&gt;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?&lt;/p&gt;</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>&lt;p&gt;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.&lt;/p&gt;</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>&lt;p&gt;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;&lt;/p&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></channel></rss>
