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
txt = "123" | |
arr = Array.new(30) { Array.new(5) } | |
arr2 = [] | |
arr2 << txt | |
arr[0][0] << arr2 | |
puts arr |
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
* * * * * mac * * * * * * | |
1 - gem install rails | |
Утилита tux | |
добавить запись в БД Пример - Barber.create :name => 'Text' | |
-=-=-=-=-=-=- О пакетах -=-=-==-=-=-=-=-- |
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 commands ------------------------------------------------- | |
git version # узнать версию git | |
git pool # загрузить изменения из указанного ранее github(pool - тянуть) | |
git clone ...repo... # загрузить полностью исходники из репозитория | |
git reset --hard HEAD | |
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 clone адрес репозитория - клонировать репозиторий на локальный компютер | |
git commit -m 'initial commit' комит изменений в локальный репозиторий | |
git push -u origin master - только первый раз отправка изменений в удаленный репозиторий | |
git push - все последующие разы отправка изменений в удаленный репозиторий | |
окат изменений | |
git pull - скачивается актуальная версия удаленного репозитория и все изменения применяются к локальному репозиторию | |
checkout - перейти в другую ветку | |
discard - не отправлять в репозиторий те изменения которые нам не нравятся |
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 - Установить соединение с базой данных. (set :database, "sqlite3:barbershop.db") | |
2 - Создаем модель (Класс) class Barber < ActiveRecord::Base end | |
3 - Создаем файл миграции утилитой rake ( rake db:create_migration NAME=name_of_migration) | |
4 - Редактируем файл миграции | |
create_table :clients do |t| | |
t.text :name | |
t.text :phone | |
t.text :datestamp | |
t.text :barber |
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
Варвара, [06.05.19 17:39] | |
А в get запросе есть порядок какой то, какое слово выдавать или рандомно? И нужно, чтобы пользователь видел правильный ответ или только true/false? Не совсем понятно что значит теряется. | |
Ivan FIlin, [06.05.19 17:48] | |
[In reply to Варвара] | |
В обработчике get запроса при создании переменной (сущности) выбирается одна запись из базы данных (рандомно). В этой переменной содержится слово и перевод. | |
Пользователь не должен видеть правильный ответ. Я планировал далее сравнивать в обработчике post запроса ответ пользователя с правильным ответом и выводить соответствующее сообщение. | |
Насколько я понял переменная в которой я передаю выбранные из базы данных данные доступна для erb файла.. но уже не доступна при обработке post запроса в app.rb | |
Ivan FIlin, [06.05.19 17:50] |
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
Docker, | |
Capistrano, | |
Chef |
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
-------------- Если настраиваем под один проект (Без RVM) | |
1 - Устанавливаем ruby (sudo apt install ruby) | |
2 - Устанавливаем sqlite3 в систему sudo apt install sqlite3 | |
3 - Устанавливаем gem sqlite3 (sudo apt install libsqlite3-dev) | |
4 - bundle install - Error | |
5 - Need to install RVM? https://www.digitalocean.com/community/tutorials/how-to-install-ruby-on-rails-with-rvm-on-ubuntu-16-04 | |
Помогло: | |
1 - Удаление строки gem sqlite3 в Gemfile и Gemfile.lock | |
2 - Перезагрузка компьютера и заново bundle 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
В терминале браузера: | |
window.localStorage.clear(); - Удалить все значения в localStorage |
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
---- rake ------------------------ | |
rake db:migrate RAILS_ENV=test - применить миграции для тестовой базы | |
---- запуск на ubuntu ------------ | |
если не работает rvm - стартуем bash --login | |
в терминале ставим галочку! | |
----------- | |
rails server - рельсы запускаются в окружении development | |
rails server -e - рельсы запускаются в окружении production |
OlderNewer