Module: SmarterAssetTagHelper::InstanceMethods
- Defined in:
- lib/smarter_asset_tag_helper.rb
Instance Method Summary collapse
-
#javascript_include_tag_with_query_strings(*sources) ⇒ Object
This is to cope with Rails appending ‘.js’ to things like Google maps API and other things that have query strings.
- #script_tag(*sources) ⇒ Object
Instance Method Details
#javascript_include_tag_with_query_strings(*sources) ⇒ Object
This is to cope with Rails appending ‘.js’ to things like Google maps API and other things that have query strings
12 13 14 15 16 17 |
# File 'lib/smarter_asset_tag_helper.rb', line 12 def javascript_include_tag_with_query_strings(*sources) query_strings_sources = sources.flatten.select { |s| s =~ /[\?]/ } sources = sources.flatten - query_strings_sources script_tag(query_strings_sources) + javascript_include_tag_without_query_strings(*sources) end |
#script_tag(*sources) ⇒ Object
19 20 21 22 23 |
# File 'lib/smarter_asset_tag_helper.rb', line 19 def script_tag(*sources) sources.map do |s| content_tag(:script, '', :src => s, :type => 'text/javascript') end.join end |