- Addd slim-select
bin/importmap pin slim-select optionaly
bin/importmap pin slim-select --download- Add css (3 variants)
- add to app/views/layouts/application.html.erb
bin/importmap pin slim-select optionaly
bin/importmap pin slim-select --downloaddef search_result
categories.each_with_object([]) do |category, keywords|
keywords << category.keywords.split(', ').select{ |c| c.include?(query) } unless category.keywords.blank?
end.flatten.tally.first(3).map(&:first)
end[1, 2, 2, 3].tally// Custom price range slider
let rangeSlider = ((containerSelector, minSelector, maxSelector, selectionSelector, inputCallback, changeCallback) => {
inputCallback = inputCallback || function () { };
changeCallback = changeCallback || function () { };
let timeout;
let sliderContainer = document.querySelector(containerSelector);
let sliderMinElement = document.querySelector(minSelector);
let sliderMaxElement = document.querySelector(maxSelector);Gemfile
gem 'impressionist',
git: '[email protected]:charlotte-ruby/impressionist.git',
ref: '46a582ff8cd3496da64f174b30b91f9d97e86643'db/migrate/xxxxxxxxxxxxxxx_add_impressions_count_to_product.rb
class AddImpressionsCountToProduct < ActiveRecord::Migration[6.1]connect() {
this.element[this.identifier] = this
}or if name have special symbol (like auto_search_controller.js -> auto-search)
connect() {
this.element[ (str => { return strYou will have four outputs for each route. These outputs are the route name (if it exists), the HTTP verb, the url pattern and the routing parameters (if they are used). These four pieces of information are very useful in determining the full route including namespaces, what the components of the URI are, the action that will be performed when the endpoint is hit and what kind of parameters can be expected.
https://localhost:3000/rails/info/routesRails 6+
bin/rails db:system:change --to=postgresqlSee list of other database type below:
rails db:system:change --to=mysql,
rails db:system:change --to=sqlite3, # app/views/messages/_message.html.erb
<%= message.decorate.formatted_for_room %>#app/decorators/message_decorator.rb
class MessageDecorator < Draper::Decorator
delegate_all