2018-06-28、29 å°éç¹ã¡ã¢
Gitã«ã³ãããããã、ãŠãŒã¶ãŒåãå®åã ã£ãã®ã§
ãã䜿ã£ãŠãããã³ãã«ããŒã ã«å€ãããå Žåã®ææ³
*ã³ãããããããŒã¿ãå€ããããã§ã¯ãªãããšã«æ³šæ
以äžã®å 容ãã·ã§ã«ã¹ã¯ãªããã§ã¯ãªã
ãã¡ããšå ¥åããå¿ èŠããã
git config --global user.name "yourname"
git config --global user.email yourname@yourname.yourname
åèãµã€ã
Gitã§ãŠãŒã¶ã確èª・å€æŽããæé
ã³ãããããããã®ãã®ãèŠãã
git diff HEAD^
åèãµã€ã
å¿ãããã人ã®ããã® git diff ããŒãã·ãŒã
rails db:migrateã§DBãã¡ã€ã«ãäœããšã®ããšã ã
rake db:migrateãããªãã£ãã?
ãšæã£ãã、æ¡ã®å®Rails5以éã¯rails db:migrateã«ãªã£ããšã®ããš
埮åŠã«rakeã£ãŠäœãªãã ãããªãšæã£ãŠããã、
ã©ãããUnixã®makeã®rubyçããæ¥ãŠããããã
ãã«ããããŒ
åèãµã€ã
ã³ã©ã 2.1. Rake
UserIDãèšå®ããéã«
Users must exist
ãšãããšã©ãŒæãåºãã®ã§äœãåå ãªãã ãããšèª¿ã¹ãŠããã
åã«belongs_to :users
ãšè€æ°åœ¢ã«ããŠããã ãã ã£ã。
æ£ããã¯、belongs_to :userã§ãã
ãªã¹ã 2.17: Userã¢ãã«ã«ååšæ§ã®ããªããŒã·ã§ã³ãè¿œå ãã
ã«ææŠããã以äžã®ãããªãšã©ãŒãåºã
undefined local variable or method `email' for User
åœæã®åç
user.rb
class User < ApplicationRecord
has_many :microposts
validates name, presence: true
validates email, presence: true
end
emailã¯å®çŸ©ãããŠããã
validates email, presence: trueãæ¶ããš
éãã、validates name, presence: trueãæ¶ããšéã«éããªããã©
äœã§ãªãã ãããªãšèª¿ã¹ããšãã
user.rb
class User < ApplicationRecord
has_many :microposts
validates :name, presence: true
validates :email, presence: true
end
ãã®éšåãç¡ãã£ãã®ãåå ã§ãã。
ããããªããšå€æ°ãã€ããã«ãªããšã®ããš
èšãããŠã¿ãã°ç¢ºãã«ããã§ããã……
ããã、nameãéã£ãçç±ã¯ããŸãã¡ããããªã……
åèãµã€ã
Railsãã¥ãŒããªã¢ã« exerciseã«é¢ããŠ
ããã、æãªãããŸãããªãã㯅…。
第äºç« çµäº。
……ãªããæ®éã«Herokuã§åãããã§ããããã¯
ãã、ããäºãªãã§ããååã¯äœã§åããªãã£ããã ããã?
èããããçç±ã¯äºã€
æ¬åœ:heroku run rails db:migrate ã䜿ããªãã£ããã。
çç±ã¯、ãããããåusersã®ããŒãžã«ã¢ã¯ã»ã¹ããã
ãšã©ãŒã«ãªã£ããã。
察æ:bundle install --without production ã䜿ããªãã£ããã
çç±ã¯、ãã®ã³ãã³ããæ¬çªã«é¢ä¿ããã³ãã³ãã®çº
--without production ãçããŠã³ãã³ãæã£ãå¯èœæ§ãããçº
以åã®èšäºãèŠãéãã ãš、ã©ã£ã¡ããã£ãŠããªãããã«èŠãã。
è¿œèšãšæžãçŽããå¿ èŠããã§ãã……
次åã¯ç¬¬äžç« ãã
Udemyã§node.jsã®å匷ããŠããã®ã ã
Syncã£ãŠæ¥æ¬èªã«èš³ããšåæãšããæå³ã«ãªã
éåæåŠçãšãã§Syncããããã§ãŠããã®ã¯ããã……。
以äžã¯kotlinã§ã®è©±
classã®ååŸããæ¹æ³ãè¯ãå¿ããã®ã§å床ã¡ã¢
HogehogeActivity::class.java
åèãµã€ã
Kotlinã§Intentãçšããç»é¢é·ç§»
class HogehogePreferenceActivity : PreferenceActivity {
//(以äžç¥)
äžèšã®ããã«æžããšPreferenceActivityã®éšåã§äžèšã®ãããªãšã©ãŒæãåºãŸã
This type has a constructor and this must be initialized here
察åŠæ¹æ³ãç°¡åã«è¿°ã¹ããšä»¥äžã®ããã«ããŸã
class HogehogePreferenceActivity : PreferenceActivity() {
//(以äžç¥)
åèãµã€ã
This type has a constructor and must be initialized here - Kotlin
ä»æ¥ã¯ãããŸã§
ãã䜿ã£ãŠãããã³ãã«ããŒã ã«å€ãããå Žåã®ææ³
*ã³ãããããããŒã¿ãå€ããããã§ã¯ãªãããšã«æ³šæ
以äžã®å 容ãã·ã§ã«ã¹ã¯ãªããã§ã¯ãªã
ãã¡ããšå ¥åããå¿ èŠããã
git config --global user.name "yourname"
git config --global user.email yourname@yourname.yourname
åèãµã€ã
Gitã§ãŠãŒã¶ã確èª・å€æŽããæé
ã³ãããããããã®ãã®ãèŠãã
git diff HEAD^
åèãµã€ã
å¿ãããã人ã®ããã® git diff ããŒãã·ãŒã
rails db:migrateã§DBãã¡ã€ã«ãäœããšã®ããšã ã
rake db:migrateãããªãã£ãã?
ãšæã£ãã、æ¡ã®å®Rails5以éã¯rails db:migrateã«ãªã£ããšã®ããš
埮åŠã«rakeã£ãŠäœãªãã ãããªãšæã£ãŠããã、
ã©ãããUnixã®makeã®rubyçããæ¥ãŠããããã
ãã«ããããŒ
åèãµã€ã
ã³ã©ã 2.1. Rake
UserIDãèšå®ããéã«
Users must exist
ãšãããšã©ãŒæãåºãã®ã§äœãåå ãªãã ãããšèª¿ã¹ãŠããã
åã«belongs_to :users
ãšè€æ°åœ¢ã«ããŠããã ãã ã£ã。
æ£ããã¯、belongs_to :userã§ãã
ãªã¹ã 2.17: Userã¢ãã«ã«ååšæ§ã®ããªããŒã·ã§ã³ãè¿œå ãã
ã«ææŠããã以äžã®ãããªãšã©ãŒãåºã
undefined local variable or method `email' for User
åœæã®åç
user.rb
class User < ApplicationRecord
has_many :microposts
validates name, presence: true
validates email, presence: true
end
emailã¯å®çŸ©ãããŠããã
validates email, presence: trueãæ¶ããš
éãã、validates name, presence: trueãæ¶ããšéã«éããªããã©
äœã§ãªãã ãããªãšèª¿ã¹ããšãã
user.rb
class User < ApplicationRecord
has_many :microposts
validates :name, presence: true
validates :email, presence: true
end
ãã®éšåãç¡ãã£ãã®ãåå ã§ãã。
ããããªããšå€æ°ãã€ããã«ãªããšã®ããš
èšãããŠã¿ãã°ç¢ºãã«ããã§ããã……
ããã、nameãéã£ãçç±ã¯ããŸãã¡ããããªã……
åèãµã€ã
Railsãã¥ãŒããªã¢ã« exerciseã«é¢ããŠ
ããã、æãªãããŸãããªãã㯅…。
第äºç« çµäº。
……ãªããæ®éã«Herokuã§åãããã§ããããã¯
ãã、ããäºãªãã§ããååã¯äœã§åããªãã£ããã ããã?
èããããçç±ã¯äºã€
æ¬åœ:heroku run rails db:migrate ã䜿ããªãã£ããã。
çç±ã¯、ãããããåusersã®ããŒãžã«ã¢ã¯ã»ã¹ããã
ãšã©ãŒã«ãªã£ããã。
察æ:bundle install --without production ã䜿ããªãã£ããã
çç±ã¯、ãã®ã³ãã³ããæ¬çªã«é¢ä¿ããã³ãã³ãã®çº
--without production ãçããŠã³ãã³ãæã£ãå¯èœæ§ãããçº
以åã®èšäºãèŠãéãã ãš、ã©ã£ã¡ããã£ãŠããªãããã«èŠãã。
è¿œèšãšæžãçŽããå¿ èŠããã§ãã……
次åã¯ç¬¬äžç« ãã
Udemyã§node.jsã®å匷ããŠããã®ã ã
Syncã£ãŠæ¥æ¬èªã«èš³ããšåæãšããæå³ã«ãªã
éåæåŠçãšãã§Syncããããã§ãŠããã®ã¯ããã……。
以äžã¯kotlinã§ã®è©±
classã®ååŸããæ¹æ³ãè¯ãå¿ããã®ã§å床ã¡ã¢
HogehogeActivity::class.java
åèãµã€ã
Kotlinã§Intentãçšããç»é¢é·ç§»
class HogehogePreferenceActivity : PreferenceActivity {
//(以äžç¥)
äžèšã®ããã«æžããšPreferenceActivityã®éšåã§äžèšã®ãããªãšã©ãŒæãåºãŸã
This type has a constructor and this must be initialized here
察åŠæ¹æ³ãç°¡åã«è¿°ã¹ããšä»¥äžã®ããã«ããŸã
class HogehogePreferenceActivity : PreferenceActivity() {
//(以äžç¥)
åèãµã€ã
This type has a constructor and must be initialized here - Kotlin
ããªãã¡ã¬ã³ã¹ã®æžãæ¹ãå¿ããã®ã§
以äžã®ãµã€ããåèã«ããŠæžãã
åèãµã€ã
ä»æ¥ã¯ãããŸã§