Backbone.js, Rails and code duplication
Posted
by
Matteo Pagliazzi
on Programmers
See other posts from Programmers
or by Matteo Pagliazzi
Published on 2012-03-26T14:12:33Z
Indexed on
2012/03/26
17:39 UTC
Read the original article
Hit count: 360
JavaScript
|ruby-on-rails
I'm building a web app and I need a JS framework like Backbone.js to work with my backend rovided by Rails that mostly return JSON objects after DB queries.
Searching on the web I've discovered Backbone which seems to be complete, quite populare and actively developed but I've noticed that a lot of things done by Backbone are simply a duplicte of the works done by Rails: for example validation and models.
My idea of "perfect" (for my actual needs) JS mvc (it can't be called mvc but i don't have any other names) is something really simple that has a function for each action in my Rails controller that are triggered by a specific event (user/hash changes, click on a button...) and send requests to the server that respond with a JSON object then I'll load a template or execute some JS code.
Do you have any concern/suggestion about my idea?
Do you know some "micro" js framework like what i have described?
If you have worked with backone.js + rails what can you suggest me?
© Programmers or respective owner