Wednesday, February 15, 2012

Rails javascript Tag

Using javascript tag allows you to include ruby code in javascript so that it gets interpreted when code is generated.

Here is an example wherein format for AnyTime.picker is dependent on the report for which the approach time field is rendered.

<%= javascript_tag "AnyTime.picker( 'approach_time', {   format: '#{@report.approach_time_format_picker}',   firstDOW: 0 } );"

No comments:

Post a Comment