Pass variables from rails to javascript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
.gitignore
Gemfile
Gemfile.lock
README.md
Rakefile
init.rb
rjv.gemspec

README.md

rjv (Rails Javascript Variables)

rjv is a set of helpers that can inject any variables from rails to your javascript code.

Usage

Add this code at the bottom of your layout file (before closing body tag).

== rjv_tags

Now you can inject variables in your views:

- set_var 'someVar', 'someValue'

In javascript this variable will be available as:

console.log(app.vars.someVar)

Copyright

Copyright (c) 2013 Michał Młoźniak.