Search code examples
javascriptbackbone.jsknockout.jssproutcore

Models in Javascript Frameworks


I started creating a web service in Ruby on Rails. After some time I discovered some amazing javascript frameworks:

  • Backbone
  • KnockoutJs
  • SproutCore
  • BatmanJs
  • etc..

Does that JS frameworks saves user informations in database (Model?) and are they good solution for creating web application intended to users?


Solution

  • The short answer is yes, JS frameworks save data in models.

    JS frameworks are good solutions if:

    • you are capable of using them - more difficult than straight RoR!
    • you apply them to the right task (e.g.: complex frontends, realtime interactions)

    There is a lot of hype over js frameworks and tools, so in general it is a good idea to learn them - although the undertaking is not trivial.

    To answer your question, well first you need Ruby alongside JS to produce meaningful apps. That said, backbone.js and others will save the data to the model, by means of passing the json object to the RoR resource, that in turn saves the data to the backend (SQL or noSQL). So, your JS models will save the data, and you also need RoR models for this to work (which can be simple and only, e.g., expose database as http(s) resources).