Max Gonzih

KEEP CALM and CODE ON

Backbone.js + Ruby on Rails Tips

| Comments

  • Add initializer that disable sending data in namespaces in json.
1
2
3
4
5
ActiveRecord::Base.include_root_in_json = false

# {"post": {"title": "some title", "content": "some content"}}
# will be
# {"title": "some title", "content": "some content}
  • Use attr_accessible for filtering attributes in mass assigments from backbone. In rails > 3.1 you can use attr_accessible with :as => role.
  • Use inherited resources for faster development.

Comments