The ability to like or favorite posts is very common on websites. This guide will show you how to add this functionality to your Rails 5 application without adding unnecessary bloat from gems. This guide assumes that you have already implemented posts (or similar) and users to your application and will not cover these steps.
Let's go over some design considerations before we begin. While everyone can view a post, only authenticated users can like posts by clicking a link or icon. We're keeping it positive by just tracking likes.more
Ransack will only search for one keyword or phrase such as, "Jumpity Jump", without quotations. Using quotations or commas such as in "Jumpity Jump" or, "Jumpity, Jump" (with or without quotations). returns a blank result.
Randomly selected records were edited to include varied words/phrases in searched fields, such as in the following examples:
jimpity jump jump
Custom predicates added to initializer based on Stack Overflow answer linked at end.more
Recently, while creating a subscription checkout form using Stripe Elements, I wanted to list the plans along wth their pricing and details.
The form uses a collection input to list the plans as radio buttons, but the methods in this guide should work for checkboxes and selects.
Here is the input statement that we are working with for starters:
<%= f.input :plan_id,
as: :radio_buttons %>
Currently, this will display the following label and radio buttons (Note that this label is provided using I18n):
Please select your plan:
○ plan 1
○ plan 2
I already have text with instructions...more