Wednesday, 21 August 2013

Common code between javascript and controllers in rails

Common code between javascript and controllers in rails

I have a set of colors which are accessed by both my controllers and
javascript files
colors = ["#66c2a5", "#abdda4", "#abdda4", "#fee08b", "#fd8d3c", "#d53e4f"]
red = ["#FFF", "#d53e4f"]
special = ["#d53e4f", "#d53e4f", "66c2a5", "#e0e0e0"]
Right now I have this duplicated twice in a common javascript file and a
common controller.
Is there a way to make this more neat and put it in one place only?

No comments:

Post a Comment