<%= yield :after_js %>
<% content_for :after_js do %>
<%= javascript_include_tag 'pages/users/index' %>
<% end %>
Rails.application.config.assets.precompile += ['pages/users/index.js']
klass = params[:commentable_type].capitalize.constantize
klass.comments.create(comments_params)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
array = %w[a b a b c d e g j a e c d k o k i l p a e c f d e a d e f s d v c ]
result = Hash[array.each_with_object(Hash.new(0)) {|e, h| h[e] += 1 }.sort_by {|k,v| -v}].keys
array = %w[a b a b c d e g j a e c d k o k i l p a e c f d e a d e f s d v c ]
array.sort_by {|v| -array.count(v)}.uniq
The result is marked as HTML-safe, but it is escaped by default, unless :escape is false. Care should be taken if text contains HTML tags or entities, because truncation may produce invalid HTML (such as unbalanced or incomplete tags).