Skip to content
Remote Javascript for Ruby on Rails
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
spec
.gitignore
Gemfile
LICENSE
Rakefile
rbjs.gemspec
readme.md

readme.md

Rbjs is a Ruby DSL that translates 1-to-1 into Javascript

It integrates with Rails 3.1 and 4, and Sinatra

What?

Instead of this (create.js.erb)

<% if @collection %>
  jQuery(<%= j render(@image) %>).appendTo('<%= dom_id @collection %>').hide().show('slide')    
<% else %>
  jQuery(<%= j render(@image) %>).insertAfter('.dropzone').hide().show('slide')
<% end %>

you can write this (create.js.rb)

if @collection
  jQuery(render @image).appendTo(dom_id @collection).hide!.show('slide')    
else
  jQuery(render @image).insertAfter('.dropzone').hide!.show('slide')
end

Why?

Why not?

Installation

Add the line

gem 'rbjs'

to your Gemfile and run

bundle install

Usage

Please refer to the documentation for a quick example and usage guide.

Something went wrong with that request. Please try again.