諸行無常

IT色々お勉強中のブログ

2016-08-01から1ヶ月間の記事一覧

cap stage deployを実行するとPermission denied (publickey)というエラー

cap stage deployを実行するとエラーになる [git][* hoge-hoge-hoge]:~/projects/hoge/ bundle exec cap stage deploy 00:00 git:wrapper 01 mkdir -p /tmp/hoge/ ✔ 01 deployer@hoge.poge.me 0.226s Uploading /tmp/hoge/git-ssh.sh 100.0% 02 chmod +rx /t…

rails sidekiqでのエラーハンドリング

sidekiqでのエラーハンドリング config/initializers/sidekiq.rb Sidekiq.configure_server do |config| config.redis = { url: 'redis://127.0.0.1:3333' } end config.redisの下に以下を追加 config.error_handlers << Proc.new { |ex, ctx_hash| Exceptio…

rails enumの表示を共通化

viewでそれぞれ書くのがめんどくさかったんでmodelに定義 human_hoge ['hoge', 'hoge2', 'hoge3'].each do |method| define_method "human_#{method}" do I18n.t("activerecord.attributes.applicant.#{method.pluralize}").fetch(send(method).to_sym) end …

git でhttpsからgit接続に変更

公開鍵作成 cd ~/.ssh/ ssh-keygen -t rsa クリップボードにコピー pbcopy < ~/.ssh/id_rsa.pub github側で登録 https://github.com/settings/ssh app/.git/configを書き換え [remote "origin"] url = git@github.com:hoge/hoge.git 毎回パスワード聞かれな…

vagrant 使ってみる

vagrant up 失敗する cd .ssh/ chmod 600 authorized_keys

rsync の使い方

.git database.yml以外削除 ls | egrep -v '^.git|config/database.yml$'|xargs rm -r ファイルコピー rsync -a pogehoge/ ~/rails_projects/hoge --exclude '.git' --exclude 'config/database.yml'

postgres コマンド色々

import psql -f dump.sql hoge_development 制約削除 ALTER TABLE applicants DROP CONSTRAINT fk_rails_cd9891c05e; スーパユーザでログイン psql postgres ユーザ一覧 \du ユーザ作成 create user yourname; 権限付与 alter role yourname createdb; おま…

rails meta_tag設定

meta_tagを設定 :ruby set_meta_tags reverse: true, title: title || t('meta.title'), description: description || t('meta.description'), ArgumentErrorエラーが出る ArgumentError - wrong number of arguments (0 for 1): def description text = nil…