Rails-tutorial初心者


2章 toy_app

↓bitbucketにpushするときに毎回でるのかな?

[vagrant@localhost toy_app]$ git push -u origin --all
To [email protected]:[username]/toy_app.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:[username]/toy_app.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.

<つまづきポイント>
bitbucketでpushできなくて、30分苦戦したけどなんとかクリア。あとで理解できたらいいな。
git pushがrejectされたときの解決方法URLまとめ

gitについて

以下のコマンドあたりを調べて押させえよう。
$ git init
$ git add
$ git remote
$ git push
$ git commit
$ git pull
$ git checkout
$ git fetch
$ git rebase
$ git merge

2章で再度リモートリポジトリでpushできなくて、苦戦中
再度、appつくりなおし。

pull = fetch + merge origin/masterの理解が必要

master と origin/master
参考https://qiita.com/osamu1203/items/cb94ef9da02e1ec3e921

non-fast-forwardについて

2.2.1完了 2018/10/19
rails generate でUsersを作成した。

2.2.2

rubyについての予備知識

@hogehogeはインスタンス変数(クラスの中で扱う変数のことです。)
通常の変数は(ローカル変数)の宣言は、特に宣言なく
hogehoge = 1とかでいけます。

defはメソッドの定義のときに利用します。

def hogehoge
  puts "hogehogehogehoge"
end

といった感じ。

resorce:users
→: シンボル(文字列の皮を被った数値)

図で整理しました。

2.3~

has_many:micropost
belongs_to:user

validates: XXXXX,prsence:true
とか

一旦は2章で完了しました。