Skip to content

Домашнее Задание 1#31

Open
eprusakov wants to merge 1 commit into
thinknetica:masterfrom
eprusakov:e_prusakov_1_homework
Open

Домашнее Задание 1#31
eprusakov wants to merge 1 commit into
thinknetica:masterfrom
eprusakov:e_prusakov_1_homework

Conversation

@eprusakov

Copy link
Copy Markdown

No description provided.

Comment thread Gemfile
gem 'slim-rails'

# Serializers
gem 'jbuilder'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не очень понравился выбор в виде jbuilder - он конечно работает из коробки и хорошо описан, но уж больно он медленный по сравнению с другими сериалайзерами. У нас он сейчас на проекте, очень страдаем от его скорости и везде где только можно переходим на alab (у которого Си под капотом)

@@ -0,0 +1,9 @@
class BooksController < ApplicationController
def index
page = params[:page].to_i.positive? ? params[:page].to_i : 1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Методу page(), который добавляет гем Kaminary можно сразу передать params[:page] - он обработает все случаи: отрицательные значение, nil, просто вандальные параметры. Т.е. можем избавиться вот от этой строки

page = params[:page].to_i.positive? ? params[:page].to_i : 1

Comment thread config/database.yml
username: <%= ENV.fetch('POSTGRES_USER') { 'igorsimdyanov' } %>
password: <%= ENV.fetch('POSTGRES_PASSWORD') { '' } %>
username: <%= ENV.fetch('POSTGRES_USER') { 'postgres' } %>
password: <%= ENV.fetch('postgres') { '' } %>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В config/database.yml помоему опечатка в следующей строке

  password: <%= ENV.fetch('postgres') { '' } %>

Тут лучше оставить значение переменной окружения POSTGRES_PASSWORD, если нужно установить пароль, то лучше это сделать в блоке метода fetch

  password: <%= ENV.fetch('POSTGRES_PASSWORD') { 'postgres' } %>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants