Module: RailsComHelper
- Defined in:
- app/helpers/rails_com_helper.rb
Instance Method Summary collapse
- #js_load(filename = nil, root: Rails.root, **options) ⇒ Object
- #simple_format_hash(hash_text, options = {}) ⇒ Object
Instance Method Details
#js_load(filename = nil, root: Rails.root, **options) ⇒ Object
3 4 5 6 7 8 9 |
# File 'app/helpers/rails_com_helper.rb', line 3 def js_load(filename = nil, root: Rails.root, **) filename ||= "controllers/#{controller_path}/#{action_name}" path = root + 'app/assets/javascripts' + filename.to_s if File.exist?(path.to_s + '.js') || File.exist?(path.to_s + '.js.erb') javascript_include_tag filename, end end |
#simple_format_hash(hash_text, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/helpers/rails_com_helper.rb', line 11 def simple_format_hash(hash_text, = {}) wrapper_tag = .fetch(:wrapper_tag, :p) hash_text.map do |k, v| text = k.to_s + ': ' + v.to_s content_tag(wrapper_tag, text) end.join("\n\n").html_safe end |