/blog/2011/09/03/backbone-js-ruby-on-rails-tips/index.html
HTML | 114 lines | 77 code | 37 blank | 0 comment | 0 complexity | 4f6b6531e7c0a0772c3a09b8d467dc4f MD5 | raw file
- <!DOCTYPE html>
- <html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us">
- <head>
- <link href="https://gmpg.org/xfn/11" rel="profile">
- <meta http-equiv="content-type" content="text/html; charset=utf-8">
- <meta name="generator" content="Hugo 0.58.0" />
-
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1">
-
- <title>Backbone.js + Ruby on Rails Tips · Max Gonzih</title>
-
-
- <link rel="stylesheet" href="https://blog.gonzih.me/css/poole.css">
- <link rel="stylesheet" href="https://blog.gonzih.me/css/syntax.css">
- <link rel="stylesheet" href="https://blog.gonzih.me/css/hyde.css">
- <link rel="stylesheet" href="https://blog.gonzih.me/css/custom.css">
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700|Abril+Fatface">
-
- <link rel="apple-touch-icon-precomposed" sizes="144x144" href="/apple-touch-icon-144-precomposed.png">
- <link rel="shortcut icon" href="/favicon.png">
-
- <link href="" rel="alternate" type="application/rss+xml" title="Max Gonzih" />
-
-
- <script id="dsq-count-scr" src="//gonzihsblog.disqus.com/count.js" async></script>
-
- <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/styles/default.min.css">
- <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/highlight.min.js"></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/go.min.js"></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/clojure.min.js"></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/vim.min.js"></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/arduino.min.js"></script>
- <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.6.0/languages/scheme.min.js"></script>
- <script>hljs.initHighlightingOnLoad();</script>
- </head>
- <body class=" ">
- <div class="sidebar">
- <div class="container sidebar-sticky">
- <div class="sidebar-about">
- <a href="https://blog.gonzih.me/"><h1>Max Gonzih</h1></a>
- <p class="lead">
- KEEP CALM and CODE ON
- </p>
- </div>
- <ul class="sidebar-nav">
- <li><a href="/">Home</a> </li>
-
- <li><a href="mailto:gonzih@gmail.com"> Email </a></li>
-
- <li><a href="https://github.com/Gonzih"> Github </a></li>
-
- <li><a href="https://blog.gonzih.me/index.xml"> RSS feed </a></li>
-
- <li><a href="https://gonzih.me"> Homepage </a></li>
-
- <li><a href="/post/"> Archives </a></li>
-
- </ul>
- <p>This work is licensed under a Creative Commons Attribution 4.0 International License.</p>
- <p class="cc-logo"><img src="https://i.creativecommons.org/l/by/4.0/88x31.png"/></p>
- </div>
- </div>
- <div class="content container">
- <div class="post">
- <h1>Backbone.js + Ruby on Rails Tips</h1>
- <span class="post-date">Sat, Sep 3, 2011</span>
- <ul>
- <li><p>Add initializer that disable sending data in namespaces in json.</p>
- <pre><code class="language-ruby">ActiveRecord::Base.include_root_in_json = false
- # {"post": {"title": "some title", "content": "some content"}}
- # will be
- # {"title": "some title", "content": "some content}
- </code></pre></li>
- <li><p>Use attr_accessible for filtering attributes in mass assigments from backbone. In rails > 3.1 you can use attr_accessible with :as => role.</p></li>
- <li><p>Use <a href="https://github.com/josevalim/inherited_resources">inherited resources</a> for faster development.</p></li>
- </ul>
- </div>
-
- <h2>Comments</h2>
- <div id="disqus_thread"></div>
- <script type="text/javascript">
-
- var disqus_shortname = 'gonzihsblog';
-
- (function() {
- var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
- dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
- (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
- })();
- </script>
- <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
- </div>
-
- </div>
- </body>
- </html>