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
Processing by SleepsController#create as HTML | |
Parameters: {"utf8"=>"✓", "authenticity_token"=>"w0wShxOtkYWylIPjmWyQXPOjdjMAK8O8uYLUH7M+w06xI27SqDRZVdoscSMbDsRkg8YEWtGyZSkIG2XxI6d0cQ==", "sleep"=>{"hours(1i)"=>"1", "hours(2i)"=>"1", "hours(3i)"=>"1", "hours(4i)"=>"06", "hours(5i)"=>"20"}, "commit"=>"Submit"} | |
(0.1ms) begin transaction | |
SQL (7.8ms) INSERT INTO "sleeps" ("hours", "created_at", "updated_at") VALUES (?, ?, ?) [["hours", 0001-01-01 06:20:00 UTC], ["created_at", 2017-04-22 11:44:40 UTC], ["updated_at", 2017-04-22 11:44:40 UTC]] | |
(2.3ms) commit transaction | |
Redirected to http://localhost:3000/sleeps | |
Completed 302 Found in 14ms (ActiveRecord: 10.2ms) |
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
$ netstat -i | |
Kernel Interface table | |
Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg | |
enp4s0 1500 0 0 0 0 0 0 0 0 0 BMU | |
lo 65536 0 6301 0 0 0 6301 0 0 0 LRU | |
wlp5s0 1500 0 276417 0 0 0 171612 0 0 0 BMRU |
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
Подскажите пожалуйста, как правильно ораганизовать рабочую среду. | |
У меня есть простой проект https://github.com/Evanto/SleepCalc. | |
Я использую на Ubuntu 16.10 (GNU/Linux 4.8.0-49-generic x86_64) Vagrant c синхронизованной папкой для разработки. На сервере в irb косноли у меня виснет транзакция. Как я понимаю, | |
мне нужна обратная синхронизация (или управляемая) чтобы можно было работать с консолью внутри гостевой машины. | |
Вот лог проблемы. Ведущая система руби конфликтует с частью пакетов и не может быть исполнена. | |
``` | |
rails c | |
Running via Spring preloader in process 8176 |
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
sudo apt-get install libpq-dev | |
http://stackoverflow.com/questions/40286351/an-error-occurred-while-installing-pg-0-19-0-and-bundler-cannot-continue | |
Rails installed on Ubuntu, but after a new app in created, when I run bundle install in the project folder, an error is thrown: | |
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. | |
............ | |
An error occurred while installing pg (0.20.0), and Bundler cannot | |
continue. | |
Make sure that `gem install pg -v '0.20.0'` succeeds before bundling. |
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
class CardsController < ApplicationController | |
# before_action :find_card, only: [:show, :edit, :update, :destroy] | |
def index | |
@cards = Card.all | |
end | |
def show | |
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
<h1>Добавить карточку</h1> | |
<%= simple_form_for Card.new do |f| %> | |
<% if Card.new.errors.any? %> | |
<% Card.new.errors.full_messages.each do |message| %> | |
<li><%= message %></li> | |
<% end %> | |
<% end %> | |
<p><%= f.label "* Вопрос:" %></p> | |
<p><%= f.input :original_text, label: false, placeholder: "не больше 200 символов" %></p> |
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
I had a code in the form: | |
<%= simple_form_for @card do |f| %> | |
<% if @card.errors.any? %> | |
<% @card.errors.full_messages.each do |message| %> | |
<li><%= message %></li> | |
<% end %> | |
<% end %> | |
<p><%= f.label "* Вопрос:" %></p> | |
<p><%= f.input :original_text, label: false, placeholder: "не больше 200 символов" %></p> |
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
Code for seed.rb which seeds the db after rake db:seed (example): | |
require 'nokogiri' | |
require 'open-uri' | |
doc = Nokogiri::HTML(open('https://www.learnathome.ru/blog/100-beautiful-words')) | |
#user = User.create(email: 'user@test.com', password: '123456788', password_confirmation: '123456788') | |
#block = Block.create(title: 'block 1', user: user) |
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
http://nashbridges.me/introducing-ruby-oop | |
https://habrahabr.ru/post/143990/ | |
https://inet777.ru/comments/9735/vnikaem-v-metaklassyi-ruby | |
https://rubydev.ru/2010/12/ruby-private-protected-public-methods/ | |
https://rubydev.ru/2012/09/self-ruby/ | |
https://sheharyar.me/blog/search-methods-of-a-ruby-object/ | |
- Объект в программировании — черный ящик, коробочка, в которой что-то происходит. Что - известно только тому | |
создателю этого объекта. Мы же видим только результаты его работы. |
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
ubuntu@rails-dev-box:~/www/qna$ rspec spec | |
F...FFFFFFFF.FF..FFFF..FFFFFFF..F.F.F...FF..FF | |
Failures: | |
1) Create question | |
In order to get answers from a community | |
as an authenticated user I want to be able to ask questions | |
Authenticated user creates a question | |
Failure/Error: expect(page).to have_content 'Your question was successfully created.' |