PageRenderTime 70ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/blog/2011/09/03/backbone-js-ruby-on-rails-tips/index.html

https://github.com/Gonzih/gonzih.github.com
HTML | 114 lines | 77 code | 37 blank | 0 comment | 0 complexity | 4f6b6531e7c0a0772c3a09b8d467dc4f MD5 | raw file
  1. <!DOCTYPE html>
  2. <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
  3. <head>
  4. <link href="https://gmpg.org/xfn/11" rel="profile">
  5. <meta http-equiv="content-type" content="text/html; charset=utf-8">
  6. <meta name="generator" content="Hugo 0.58.0" />
  7. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
  8. <title>Backbone.js &#43; Ruby on Rails Tips &middot; Max Gonzih</title>
  9. <link rel="stylesheet" href="https://blog.gonzih.me/css/poole.css">
  10. <link rel="stylesheet" href="https://blog.gonzih.me/css/syntax.css">
  11. <link rel="stylesheet" href="https://blog.gonzih.me/css/hyde.css">
  12. <link rel="stylesheet" href="https://blog.gonzih.me/css/custom.css">
  13. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
  14. <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
  15. <link rel="shortcut icon" href="/favicon.png">
  16. <link href="" rel="alternate" type="application/rss+xml" title="Max Gonzih" />
  17. <script id="dsq-count-scr" src="//gonzihsblog.disqus.com/count.js" async></script>
  18. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/default.min.css">
  19. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script>
  20. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/go.min.js"></script>
  21. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/clojure.min.js"></script>
  22. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/vim.min.js"></script>
  23. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/arduino.min.js"></script>
  24. <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/scheme.min.js"></script>
  25. <script>hljs.initHighlightingOnLoad();</script>
  26. </head>
  27. <body class=" ">
  28. <div class="sidebar">
  29. <div class="container sidebar-sticky">
  30. <div class="sidebar-about">
  31. <a href="https://blog.gonzih.me/"><h1>Max Gonzih</h1></a>
  32. <p class="lead">
  33. KEEP CALM and CODE ON
  34. </p>
  35. </div>
  36. <ul class="sidebar-nav">
  37. <li><a href="/">Home</a> </li>
  38. <li><a href="mailto:gonzih@gmail.com"> Email </a></li>
  39. <li><a href="https://github.com/Gonzih"> Github </a></li>
  40. <li><a href="https://blog.gonzih.me/index.xml"> RSS feed </a></li>
  41. <li><a href="https://gonzih.me"> Homepage </a></li>
  42. <li><a href="/post/"> Archives </a></li>
  43. </ul>
  44. <p>This work is licensed under a Creative Commons Attribution 4.0 International License.</p>
  45. <p class="cc-logo"><img src="https://i.creativecommons.org/l/by/4.0/88x31.png"/></p>
  46. </div>
  47. </div>
  48. <div class="content container">
  49. <div class="post">
  50. <h1>Backbone.js &#43; Ruby on Rails Tips</h1>
  51. <span class="post-date">Sat, Sep 3, 2011</span>
  52. <ul>
  53. <li><p>Add initializer that disable sending data in namespaces in json.</p>
  54. <pre><code class="language-ruby">ActiveRecord::Base.include_root_in_json = false
  55. # {&quot;post&quot;: {&quot;title&quot;: &quot;some title&quot;, &quot;content&quot;: &quot;some content&quot;}}
  56. # will be
  57. # {&quot;title&quot;: &quot;some title&quot;, &quot;content&quot;: &quot;some content}
  58. </code></pre></li>
  59. <li><p>Use attr_accessible for filtering attributes in mass assigments from backbone. In rails &gt; 3.1 you can use attr_accessible with :as =&gt; role.</p></li>
  60. <li><p>Use <a href="https://github.com/josevalim/inherited_resources">inherited resources</a> for faster development.</p></li>
  61. </ul>
  62. </div>
  63. <h2>Comments</h2>
  64. <div id="disqus_thread"></div>
  65. <script type="text/javascript">
  66. var disqus_shortname = 'gonzihsblog';
  67. (function() {
  68. var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
  69. dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
  70. (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
  71. })();
  72. </script>
  73. <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  74. </div>
  75. </div>
  76. </body>
  77. </html>