From 0c8442e2ab8ead2bb34c660d17437a8f8f44f6e2 Mon Sep 17 00:00:00 2001 From: Elias Ojala Date: Tue, 23 May 2017 22:51:12 +0300 Subject: [PATCH] Improved formatting of markdown --- README.md | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index bb424bc..1f4da27 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ Easily setup and use backbone.js (1.2.2) with Rails 3.1 and greater -##Version## +## Version -###Github master branch### +### Github master branch Gem version : 1.2.2 @@ -12,7 +12,7 @@ Backbone version : 1.2.2 Underscore version : 1.8.3 -###Rubygems### +### Rubygems Gem version : 1.2.2 @@ -21,12 +21,12 @@ Backbone version : 1.2.2 Underscore version : 1.8.3 -##Credits## -###Author### +## Credits +### Author [Ryan Fitzgerald](http://twitter.com/#!/TheRyanFitz) ###Current Maintainer [Manu S Ajith](http://twitter.com/manusajith) -###Contributors### +### Contributors These [awesome people](https://github.com/codebrew/backbone-rails/graphs/contributors) helped to keep this gem updated ## Rails setup @@ -102,27 +102,30 @@ You have one last step: Edit your posts index view `app/views/posts/index.html.erb` with the following contents: -
+```html +
- + +``` If you prefer haml, this is equivalent to inserting the following code into `app/views/posts/index.html.haml`: - #posts - - :javascript - $(function() { - // Blog is the app name - window.router = new Blog.Routers.PostsRouter({posts: #{@posts.to_json.html_safe}}); - Backbone.history.start(); - }); +```haml +#posts +:javascript + $(function() { + // Blog is the app name + window.router = new Blog.Routers.PostsRouter({posts: #{@posts.to_json.html_safe}}); + Backbone.history.start(); + }); +``` Now start your server `rails s` and browse to [localhost:3000/posts](http://localhost:3000/posts) You should now have a fully functioning single page crud app for Post models. @@ -133,7 +136,7 @@ Sample application can be found [here](https://github.com/manusajith/backbone-ra ####Overrides backbone sync function#### This gem overrides the backbone sync function. Check [here](https://github.com/codebrew/backbone-rails/blob/master/vendor/assets/javascripts/backbone_rails_sync.js) for details. -####With Rails 4:#### +#### With Rails 4: If you are using the default Rails 4 scaffold generators, you will need to adjust the default JSON show view (IE, 'show.json') to render the 'id' attribute. default rails generated show.json.jbuilder