This file contains 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
# BasketController < ApplicationController | |
# должен наследоваться от класса ApplicationController | |
# контроллер должен быть "тонким" | |
class BasketController | |
def add_to_basket | |
# лучше всего искать по id, так как в названиях возможны совпадения | |
# так же можно вынести в приватный метод find_by_id (=> Item.find(params[:id])) |
This file contains 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. Сформированные HTTP-запросы и полученные HTTP-ответы (URL: http://httpbin.org/anything): | |
> ncat -C httpbin.org 80 | |
GET /anything HTTP/1.1 | |
Host: httpbin.org | |
HTTP/1.1 200 OK | |
Date: Fri, 03 Apr 2020 18:36:02 GMT | |
Content-Type: application/json | |
Content-Length: 287 |
This file contains 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. С помощью SQL (DDL): | |
> CREATE DATABASE test_guru; | |
CREATE DATABASE | |
> \c test_guru | |
Вы подключены к базе данных "test_guru" как пользователь "postgres". |
This file contains 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
После переустановки ОС или клонировании вашего репозитория на другую локальную машину, съемный жесткий диск и прочее | |
может возникнуть проблема, которая при команде `git status` показывает, что все (или не все) фалы были изменены | |
хотя вы ничего не изменяли, а только копировали репозиторий: | |
$ git diff | |
#=> old mode 100644 | |
new mode 100755 | |
Есть два способа решить эту проблему: | |
This file contains 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
КАК ПРИКРУТИТЬ BOOTSTRAP К RAILS 6 (без gem !) | |
1) Обновляем yarn, ставим последнюю lts версию nodejs (через nvm или “напрямую”). | |
``` | |
bundle | |
bundle exec rails webpacker:install | |
yarn upgrade | |
yarn install |
This file contains 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
Had Ruby on Rails been created for design applications? | |
It had been created for desingers. | |
No | |
Yes |
This file contains 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
Is Ruby language for backend development? | |
Yes | |
No | |
It has been using only for user interface. | |
It is the language for system administration. |
This file contains 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
module Storage | |
module Models | |
class Brand < ActiveRecord::Base; end | |
end | |
end |
This file contains 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
# .github/workflows/rubocop.yml | |
name: RuboCop | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest |
This file contains 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
# app.json | |
{ | |
"name": "review-test-guru-app", | |
"description": "The application for creating and passing tests with ability to save questions to GitHub Gist.", | |
"repository": "https://github.com/georgiybykov/test-guru", | |
"scripts": { | |
"postdeploy": "pg_dump -Fc $DATABASE_URL | pg_restore --clean --no-owner -n public -d $DATABASE_URL && bundle exec rails db:migrate" | |
}, | |
"env": { |
OlderNewer