Module: Jsboot::Rails::ViewHelpers

Defined in:
lib/jsboot/rails/view_helpers.rb

Instance Method Summary collapse

Instance Method Details

#jsboot_data_tag(data = {}, key = jsboot_default_key) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/jsboot/rails/view_helpers.rb', line 5

def jsboot_data_tag(data = {}, key = jsboot_default_key)
  data ||= {}
  id = "jsboot-#{key}"
  id.tr!('#', '-')

   :script, :id => id, :class => "jsboot-data", :type => "application/json" do
    jsboot_json_escape data.to_json.html_safe
  end
end