Project

de_rjs

0.0
No commit activity in last 3 years
No release in over 3 years
de-RJS your application
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 9.0

Runtime

< 2.5, >= 2.3.1.2
< 5.1, >= 4.2
 Project Readme

Use this to de-RJS your application.

Converts your .rjs code into js.erb compliant code

CAVEATS

dom_id_or_string

page[@record], where @record is a ActiveRecord object would translate to $("<%= dom_id(@record)") perfectly fine.

However, if @var computes to a string, such as @var = "fixed_id", then dom_id(@var) will result in an error. Hence for safety, I have decided to transcode page[@var] to :

$("<%= dom_id_or_string(@var) $>")

You can either choose to visually inspet the diff and manuall replace each occurence back to dom_id, or you can define the following method:

def dom_id_or_string(thing)
  case thing
  when String, Symbol, NilClass
    thing
  else
    dom_id(thing)
  end
end