README.md in gon-0.1.0 vs README.md in gon-0.1.1
- old
+ new
@@ -1,13 +1,37 @@
# Gon gem — get your Rails variables in your js
-TODO: write description
+If you need to send some data to your js files and you don't want to do this with long way trough views and parsing - use this force!
## Usage
-TODO: write usage
+`app/views/layouts/application.html.erb`
+``` erb
+<head>
+ <title>some title</title>
+ <%= gon_variables %>
+ <%= javascript_include_tag 'http://code.jquery.com/jquery-1.6.min.js' %> <!-- include jquery -->
+ <%= include_gon_js %> <!-- http://gaziev.com/files/gon.js -->
+ ...
+```
+
+In action of your controller you put something like this:
+
+``` ruby
+@your_variable = 123
+Gon.your_variable = @your_variable
+Gon.your_other_variable = 345 + @your_variable
+```
+
+In javascript file for view of this action write call to your variable:
+
+``` js
+alert(Gon.your_variable)
+alert(Gon.your_other_variable)
+```
+
## Installation
Puts this line into `Gemfile` then run `$ bundle`:
``` ruby
@@ -18,10 +42,10 @@
``` ruby
config.gem 'gon', :version => '0.1.0'
```
-Or manually install variants gem: `$ gem install gon`
+Or manually install gon gem: `$ gem install gon`
## Contributors
* @gazay