This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add -> | |
GemFile: | |
gem 'devise', '~> 4.8' | |
gem 'omniauth' | |
gem 'omniauth-facebook' | |
gem 'omniauth-github' | |
gem 'omniauth-google-oauth2' | |
gem 'activerecord-session_store' | |
gem 'omniauth-rails_csrf_protection' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Models: | |
------- | |
1) | |
user.rb | |
has_many :recipes | |
2) | |
recipe.rb # add counter_cache: true to recalculate posts_count field in user table | |
belongs_to :user, counter_cache: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1) | |
# Gemfile | |
gem 'rails-i18n' | |
bundle | |
2) | |
bin/rails g migration add_language_to_users language |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Export html page to PDF (Rails 6, Heroku) | |
----- Model: Recipe ----- | |
1) | |
Gemfile | |
========== | |
gem 'grover' (https://github.com/Studiosity/grover) | |
Terminal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------- model Recipe ------------- | |
1) Controllers: Recipes | |
======================= | |
class RecipesController < ApplicationController | |
after_action :register_visit, only: :show | |
attr_accessor :recipe | |
helper_method :recently_recipes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------- model Recipe ----------- | |
Before: Stimulus must be installed -> rails webpacker:install:stimulus (yarn add stimulus) | |
1) Gemfile: | |
=========== | |
gem 'pg_search' # По желанию (Optional) | |
2) touch app/views/shared/_search_form.html.erb | |
================================================ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
================= | |
1. Add to Gemfile | |
================= | |
gem 'omniauth' | |
gem 'omniauth-facebook' | |
gem 'omniauth-github' | |
gem 'omniauth-google-oauth2' | |
gem 'activerecord-session_store' | |
gem 'omniauth-rails_csrf_protection' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-------------------- model Recipe + Favorites ----------------------- | |
1. Add pagination: | |
=============== | |
Gemfile | |
------- | |
gem 'pagy' | |
$bundle |