https://github.com/tompave/springyrailsdemo
A very basic Ruby on Rails 3.2.9 application to demonstrate how to use a canvas graph (powered by Springy by dhotson) with Ruby to represent Rails' ActiveRecord associations.
https://github.com/tompave/springyrailsdemo
Last synced: about 1 year ago
JSON representation
A very basic Ruby on Rails 3.2.9 application to demonstrate how to use a canvas graph (powered by Springy by dhotson) with Ruby to represent Rails' ActiveRecord associations.
- Host: GitHub
- URL: https://github.com/tompave/springyrailsdemo
- Owner: tompave
- Created: 2012-11-20T15:46:20.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2012-12-23T17:36:32.000Z (over 13 years ago)
- Last Synced: 2025-02-01T08:41:46.425Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 184 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#SpringyRailsDemo
This is a very basic Ruby on Rails 3.2.9 app to demonstrate how to use a canvas network graph with Ruby to represent Rails' ActiveRecord associations.
The JavaScript data model to store the graph nodes, the HTML5 canvas drawing code (with a couple of edits), and everything else canvas-related is taken from the excellent [Springy Algorithm](https://github.com/dhotson/springy) by Dennis Hotson.
This demo is meant as an example of how to transform your models and your associations into a set of variables you can work with, and how to integrate these variables with the drawing Javascript code in the view.
The random names are provided by the [Faker Gem](http://faker.rubyforge.org/) by Benjamin Curtis.
##Partials
Partials for the **has\_and\_belongs\_to\_many** and the **has_many :through** associations are kept separate to make it easier to see how they work.
They are quite similar though, and it would be easy to use just one partial with a couple of conditional statements.
##Demo
You can see it in action [here](http://springyrailsdemo.herokuapp.com/). It's on the Heroku free plan, so be patient if it takes a few seconds to wake up.