backbone on rails with persistence - ruby-on-rails-3

I have an app that I'm building and would like to implement rails persistence to the backbone front end.
can someone point me to a simple repo or tutorial where i can learn about the configuration needed in rails to be able to persist data.
Thanks

I suggest to take a look at the backbone-rails gem.
It also provides a backbone:scaffold generator (I find that many rails generators can be used like "tutorial").

Related

Does MEAN.js has something similar to Sails.js blueprints?

Sails.js has a functionality called Blueprints that automatically creates API code that can search, paginate, sort, filter, create, destroy, update based on a model.
Can I achieve the same with MEAN.js?
No. I tried looking, it doesn't look like MEAN.js has blueprints-like feature.
However, if you start implementing routes as you need and abstract common functionality, it should be good.
Sails blueprints are only good as starting point, in decently complex application you have to write own controller code.
PS: I don't use MEAN.js (use Sails though).

backbone.js views to rails view

My main goal is to remove the backbone.js views/template and implement them to rails views. What is the best way/practices to do this? As there is lots of stuff going on the backbone.js views, is there any way that i can preserve the functionality and just convert them in rails views.
Helpful if you answer contains the steps.
Thanks.
I don't think is good idea to make any kind of dependency between your server layer and your client layer.
Starting from the point that the View concept in Backbone is nothing related to the View concept in Rails.

Helper Gem for Rest on Rails 3

I know that Rails has some tools on board to create a REST API. However, concepts like HATEOS aren't supported out of the box.
I googled around for Gems that are filling the gap. The most complete Gem I found is Restfulie (https://github.com/caelum/restfulie). But I am not complete convinced about Restfulie and the project looks abandoned. Hence, I am looking for good alternatives to Restfulie.
What's the best Gem to create a REST API for Rails?
Popular choices are RABL and Roar / roar-rails.
I personally like Roar better because it allows you to consume your representations which is a bit harder with RABL. On the other hand, it's concepts are still in flux so things still tend to change.
Grape is worth a try.

Ruby on Rails 3: administration interface generator?

I'm looking for some gem/library able to generate administration interface for my RoR3 project.
I don't want to have some library/gem with its own logic and data in some gem repo, I want it to be not just integrated with my app, but be actual part of it, have ability to tweak and modify logic, views, etc...
ATM I've tried rails_admin and it seems to be the best imho, but during development lots of issues came out: i18n issues, additional pages, custom controls, lack of documentation on extending it, ... There's a lot actually. Maybe for something simple its a perfect match, but not for projects requiring complex administration interface.
So any ideas on gem/library I can use?
Thanks.
Active Admin:
Active Admin is a Ruby on Rails plugin for generating administration
style interfaces. It abstracts common business application patterns to
make it simple for developers to implement beautiful and elegant
interfaces with very little effort.

Expose function in ruby on rails

I am looking at a rails app and at the top of every controller there is a block of code that looks something like this
expose(:var) {Model.find params[:var_id]}
I understand what is inside the block just fine but...
I cannot find any documentation on what the expose function does where it comes from or anything I have tried searching the project and using the searchable rails docs.
I would love to know what it does, can someone please tell me or point me to the docs.
This is probably referencing the decent_exposure gem. You can learn more about it here: http://railscasts.com/episodes/259-decent-exposure
Source: https://github.com/voxdolo/decent_exposure
It's a method from the Decent Exposure gem. You can check out a screencast that Ryan Bates did on it over at Railscasts. It's a really great gem. I use it in my application. It cuts down on a lot of the redundancy in the controller layer.
expose is not a part of Rails, it comes from the decent_exposure gem.
It is not an answer to the question. I just want to make the Rails world a bit better and I hope that somebody will read this.
Please think twice before using expose. You should only use it if you 100% sure you are using it the right way and it really makes the code better. Read the documentation properly!
One of projects I worked on became unmaintainable because of tons of expose in controllers which replaced not only all #instance_variables passed to views, but also a lot of business logic and the most helper methods.
When you use expose it is not clear in which controller actions and in which views it is used. Unexperienced developers combine data and logic for multiple actions and multiple views in the same expose block.
That's a nightmare.
Believe me, expose really destroys projects if not used properly.