Rails Developers Meetup 2019ï¼2019/03/22 - 23ï¼
Rails Developers Meetup 2019ï¼2019/03/22 - 23ï¼
æ ªå¼ä¼ç¤¾LITALICO ã®klrutsaã§ãã ãLITALICO Advent Calendar 2016ã13æ¥ç®ã®è¨äºã§ãã ã¯ããã« ç§ãééãããRailsã¢ã³ããã¿ã¼ã³éã§ãã ç¬ããããããç¬ããªãã³ã¼ãã®ã»ããå¤ãã§ããããããããé¡ããã¾ãã ååã®ãè² åµãæ±ããããRailsã¢ããªã®ãªãã¡ã¯ã¿ãªã³ã° - Qiitaã§ã¯ãè¤éãªç¶æ é·ç§»ã¸ã®å¯¾å¿æ¹æ³ãæ¸ãã¾ãããããã®ä»ã®è² åµãã©ããããã¿ãããªãã¨ã«ã¤ãã¦æ¸ãã¦ã¿ã¾ãã ä¸è¬çã«æ¸ãã¦ã¯ãããªããã¨ã¾ã§ã¯ãããªããããããªãã§ããã å人çã«ã¯æ¸ããªãã»ããè¯ãã¨æã£ã¦ããã³ã¼ãéã§ãã default_scope class Article < ActiveRecord::Base default_scope { where(status: 'publish') } end è¦ç¹ ããã°ã©ãã®èªèãã¦ããåä½ã¨å®éã®
2018.07.30 é±åRailsã¦ã©ããï¼20180730ï¼Rubyã®éãæ¸ãæ¹éãæè¿ç»å ´ã®Railsã¢ããªãã¡ãRubyWorld Conferenceåä»éå§ã»ã ããã«ã¡ã¯ãhachi8833ã§ãããã£ã¨Gobyã«Ripperã©ã¤ãã©ãªããã¼ã¸ãã¾ããã æã®éã®æ¶¼ããå¤æ¥ã®ã¦ã©ããããã£ã¦ã¿ã¾ãããã åè¨äºåé ã«ã¯âã§ãã¼ããªã³ã¯ãç½®ãã¦ããã¾ã: 社å ãTwitterã§ã®è°è«ãªã©ã«ã©ãã âããç¥ãããé±åRailsã¦ã©ãããå ¬éã¤ã£ã¤ãä¼ ç¬¬1åãä»é±8/2ï¼æ¨ï¼éå¬ ä»é±æ¨ææ¥ã§ããå¼ãç¶ãåå ããå¾ ã¡ãã¦ããã¾ãï¼ðæ親ä¼ã«ã¦è»½é£&ãã¼ã«ããå¾ ã¡ãã¦ãã¾ãðºã ã宣ä¼ãå¼ç¤¾ã§æ¯é±ãã£ã¦ããRuby/Rails/Webéçºé¢é£ã®ææ°surveyä¼ã§ããé±åRailsã¦ã©ããã®ãªãã©ã¤ã³å ¬éåå¼·ä¼ã8/2ï¼æ¨ï¼ã«éå¬ãã¾ãã10人以ä¸ã®ã²ã£ããã¨ããè¦æ¨¡ã§è©¦ãã«ãã£
#ã¯ããã« æè¿ãããã¸ã§ã¯ã管çæ¥åãæ¥åã®å¤§åãå ãã¦ããã ããã°ã©ã ãæ¸ãæ©ä¼ããªããªãããã¾ããã ãã®ã¾ã¾ã ã¨ããã°ã©ã ãã¾ã£ããæ¸ããªã人ã«ãªã£ã¦ãã¾ãå±æ©æï¼è¿«ãæ¥ã35æ³å®å¹´èª¬ï¼ã¨ã æ°ãããã¨ã«ææ¦ãããã¨ããæãããã Ruby on Rails ãã¥ã¼ããªã¢ã«å®ä¾ã使ã£ã¦Railsãå¦ã¼ã 第4çãå¦ç¿ä¸ã§ãã æ¥åã§ä½¿ãã®ã¯ãã£ã±ãJavaãªã®ã§ãããRails楽ããã§ããã ããã¾ã§Evernoteã«è¨é²ãã¦ãã¾ããããã½ã¼ã¹ã³ã¼ãã®è²¼ä»ãã«éçãæããããã Qiitaã§èªåãå¦ç¿ããçµæãã¢ã¦ãããããã¦ããã¾ãã å人ã®è§£çä¾ãªã®ã§ã誤ããããã°ãææãã ããã ##8.3 ãã°ã¢ã¦ã ###æ¬ç« ã§ã®å¦ã³ ####ã»ãã·ã§ã³ã®ç ´æ£ ã»ãã·ã§ã³ã®ç ´æ£ã¯ãdestroyã¢ã¯ã·ã§ã³ã§è¡ãã ####ã»ãã·ã§ã³ã®ç ´æ£ ã»ãã·ã§ã³ããã¦ã¼ã¶IDãåé¤ããããã«ãde
2014/5 æ´æ° ãã¼ã¸ã§ã³è¦ãã¦ãªããã©ãå¤åRuby:2.0ãRails:3.2 åæ Railsã®DBMSãåæè¨å®ã®SQLiteããMySQLã«å¤ããæ¹æ³ã§ãããããåèã«ãã¾ããã 大äºãªæãä»ãµã¤ãã«ä¸¸æããããã£ãããªã¾ã¨ãã§ããæªãããã⦠MySQLè¨å® ã¤ã³ã¹ãã¼ã« ã¾ãã¯ãMySQLãå ¬å¼ãµã¤ããããã¦ã³ãã¼ããã¾ãã æé ã¯ãã®ãµã¤ãã«è©³ããæ¸ãã¦ããã®ã§åç §ãã¦ãã ããã åæè¨å® ã¤ã³ã¹ãã¼ã«ããããMySQLãèµ·åãã¦åæè¨å®ããã¾ãã 詳ããã¯ãããã¤ã³ã¹ãã¼ã«ã§ã©ããã ä½æ¥ã¦ã¼ã¶ã¼ä½æ 次ã«ä½æ¥ã¦ã¼ã¶ã¼ãä½æãã¾ãã 以ä¸ãè¦ã¦ããã ãã¨åããã®ã§ãããä½æ¥ã¦ã¼ã¶ã¼ã¯developmentãtestãproductionã®ï¼ã¤å¿ è¦ã«ãªãã¾ããï¼developmentã¨productionã¯åãã¦ã¼ã¶ã¼ã§ãè¨å®ä¸ã¯å¤§ä¸å¤«ã§ãããæ¬çªç°å¢ãè¦æ®ãã¦prod
ããã¶ãåã®ãã¨ã ããWebã¢ããªã±ã¼ã·ã§ã³éçºãã¬ã¼ã ã¯ã¼ã¯ãRuby on Railsãã00年代å¾åã«ãã¼ã ãå·»ãèµ·ãããã¨ããå¼·ã主張ãæã¤ã½ããã¦ã§ã¢ã¨ãã¦Railsã¯å¤ãã®è°è«ãå¼ã³èµ·ãããããã®ä¸ã§ãæ大ã®ãã®ã¯ããã°ã©ãã®çç£æ§ã«é¢ãããã®ãå½æããã§ã«ããã¤ãåå¨ãã¦ããJavaãã¼ã¹ã®Webã¢ããªã±ã¼ã·ã§ã³éçºãã¬ã¼ã ã¯ã¼ã¯ã«æ¯ã¹ã¦ãRuby on Railsã¯10åã®çç£æ§ãéæã§ããã¨ãã主張ã ã Rubyã®çç£æ§ã¯Javaã®10åââããã®ä¸»å¼µãå¤ãã®ã¨ã³ã¸ãã¢ã®ç´ç·ããããã¯éé±ã«è§¦ãããããããã«10åã¯å¤§ããã ããããããç¾å®ã«è¨å®ãã¡ã¤ã«ãã³ã¼ããæ¸ãè¡æ°ãåçã«æ¸ãã®ã ããããã®ãããå½ç¶ã ãã¨æè¦ãåãããã®ã ã 2005å¹´ã®ãªãªã¼ã¹ããç´10å¹´ãRailsã®çã¿ã®è¦ªã§ãä»ãããã¸ã§ã¯ãããªã¼ããããã¤ãããã»ãã¤ããã¤ã¤ã¼ã»ãã³ã½ã³æ°ã¯å½æãæ¯ãè¿ã
æ¦è¦ 1å¹´éRuby on Railsã®ããã¸ã§ã¯ãããã£ã¦ãã¦ãããã«ãªã£ãæ¸ç±ããµã¤ããã¾ã¨ãã¦ã¿ãã ä»ã«ä½ããªã¹ã¹ã¡ããã£ããæãã¦ãã ããã æ¸ç± åãã¦ã®ruby é å±ããã¦åã®æ¥ååã«å 輩ã«é²ããããæ¬ãããã åãã¦ã¨åãä»ãã¦ããããé£ããã£ãè¨æ¶ãããã ãã¼ãã§ã¯ã Ruby on Rails part1,2ã¯ããç¨åº¦ããã£ã¦ããããpart3,ï¼è¾ºãâ¦ç¹ã«9ç« ã¯ã¾ã¨ã¾ã£ãè³æããªãã£ãã®ã§ããããåèã«ãªã£ãã å°ãã ãæ¸ããããã«ãªã£ãèªåã«ã¨ã£ã¦ã¯ã次ã®æ®µéã«ãããããã®è¯ããã£ããã¨ãªã£ãã Everyday Rails - RSpecã«ããRailsãã¹ãå ¥é ããç¨åº¦ããã¸ã§ã¯ãã«æ £ãã¦ãããããã®æã«ãæ¥æ¬èªè¨³ãçºå£²ãããã®ã§è³¼å ¥ããã ä»ã¾ã§ã¯ãããã¸ã§ã¯ãå ã®æ¢åã®ãã¹ãã模å£ããããã«æ¸ãã¦ããããèªãã§ããã¯æå³ããã£ã¦æ¸ããããã«ãªã£ãã¨æãã
â»ãã®å 容ã¯Railsã§æ¸ãããWantedlyã®ããã¸ã§ã¯ãã«åå ãããã¨ãæ³å®ãã¦ãã¦ãä¸é¨Railsã®ããã©ã«ãã§ãªãæ©è½ã®è§£èª¬ãããã¾ããã使ã£ã¦ããgemãã¡ã¸ã£ã¼ãªãã®ã§å²ã¨æ±ç¨çãªå 容ã«ãªã£ã¦ããã¨æãã®ã§ãæ¯éåèã«ãã¦ã¿ã¦ãã ããã URLãè¦ãã°ã ãããã©ããå¤æ´ããã°ããããããã¨è¨ãã㨠Ruby on Railsã¯MVC(Model View Controller)ã«ãã¨ã¥ãã¦è¨è¨ããã¦ãã¦ããã£ã¬ã¯ããªæ§é çã«ãapp/以ä¸ã«ç¶ºéºã«åããã¦ããã MVCã£ã¦ä½ï¼ã£ã¦äººã¯ãã°ã°ã£ã¦ã¿ã¦ã»ããããå²ã¨å®æè«äºã«ãªãããã¦ããã®ã§ãã¢ãã«ã¯DBã®åãã¼ãã«ã«é¢é£ãã¦ãã¦ããã¥ã¼ã¯HTMLã®é¨åã«è¿ãã¦ãã³ã³ããã¼ã©ã¼ã¯ãã¥ã¼ç¨ã«ã¢ãã«ãå¼ã£å¼µã£ã¦ããã¤ãªãå½¹ã ã¨æã£ã¦ãã°å¤§ä½åã£ã¦ããããã以ä¸ã¯æ·±ãèããã«ã³ã¼ããèªãã ã»ããè¯ãã¨æãã Router ã§ãã³ã¼ãç
Railsã¢ããªã±ã¼ã·ã§ã³éçºãå®å ¨ã«Dockeråãã Tweet Degica ã®ãã¹ã¦ã®ãµã¼ãã¹ã¯ Rails ã§éçºãã¦ããããã®ãã¡ã®ä¸é¨ã¯ Docker ã使ç¨ããæ¬çªç°å¢ã«ãããã¤ãã¦ãã¾ãããããéçºè å人ã®éçºç°å¢ã«ã¯ãã¾ã ã« Docker ãå°å ¥ã§ãã¦ãã¾ãããæã大ããªé害㯠spring ã docker ã³ã³ããå ã§ä¸æãæ±ãæ¹æ³ã確ç«ããã¦ããªãã£ããã¨ã§ããããã®åé¡ã¯ docker-compose ã工夫ãã¦å©ç¨ãããã¨ã§è§£æ±ºå¯è½ã§ãããã¨ããããã¾ããã ã¨ãããã¨ã§ãä»å㯠rails ã¢ããªã±ã¼ã·ã§ã³ã®éçºç°å¢ãå®å ¨ã« docker åããæ¹æ³ãç´¹ä»ãã¾ãã å®å ¨ã«ãã¨ããã¨ããããã¤ã³ãã§ãããã®æ¹æ³ã使ãã° docker 以å¤ã®ãã¼ã«ãä¸åãã¹ããã·ã³ã«ã¤ã³ã¹ãã¼ã«ããã« rails ã¢ããªã®éçºãè¡ããã¨ãã§ãã¾ãã (ã¡ãªã¿ã«ãå¼ç¤¾ã®æ¬çªç°å¢ã¯
# -*- coding: utf-8 -*- worker_processes Integer(ENV["WEB_CONCURRENCY"] || 2) timeout 15 preload_app true # æ´æ°æãã¦ã³ã¿ã¤ã ç¡ã listen "/tmp/sockets/unicorn.sock" pid "/tmp/sockets/unicorn.pid" before_fork do |server, worker| Signal.trap 'TERM' do puts 'Unicorn master intercepting TERM and sending myself QUIT instead' Process.kill 'QUIT', Process.pid end defined?(ActiveRecord::Base) and ActiveRecord::Base
# -*- coding: utf-8 -*- # ã¯ã¼ã«ã¼ã®æ° worker_processes 2 # ã½ã±ãã listen '/tmp/unicorn.sock' pid '/tmp/unicorn.pid' # ãã° log = '${my_app}/log/unicorn.log' stderr_path File.expand_path('log/unicorn.log', ENV['RAILS_ROOT']) stdout_path File.expand_path('log/unicorn.log', ENV['RAILS_ROOT']) preload_app true GC.respond_to?(:copy_on_write_friendly=) and GC.copy_on_write_friendly = true before_fork do |server,
#ã¯ããã« Railsã§éçºãããã¨ããRDBã¸ã®ãã¼ã¿æä½ã¯ActiveRecordãä»ãã¦å®æ½ãããDBãã¼ã¿ã®å¤æ´ããªãã¸ã§ã¯ãã®å¤æ´ã«æ½è±¡åããããããSQLãç¥ããªãã¦ããã¼ã¿ãã¼ã¹ã¸ã®ãã¼ã¿ã®æ¸ãè¾¼ã¿ãåãåºããä¸æ¸ããåé¤ã¨ãã£ãæä½ãã§ãããã¨ãã§ããã®ã ãã©ãSQLãããç¨åº¦ç¥ã£ã¦ãã人ã«ã¯è¾ãã£ãããããï¼ãã®SQLãæ¸ãããã«ã¯ããActiveRecordã§ã©ãæ¸ãã°ãããã ï¼çãªï¼ãªã®ã§ãããã®è¨äºã«ã¾ã¨ãã¦ããã #åæ æ±ãã¢ãã«ã¯ä¸ã®ãããªãã¼ãã«ã¨ããã usersãã¼ãã« mysql> desc users; +-----------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-
(訳注: 2016/3/2ãé ãããã£ã¼ãããã¯ããã¨ã«è¨äºãä¿®æ£ãããã¾ããã) Ruby on Railsã¯æè¿ãæ¥æ¿ã«æ³¨ç®ãéãã¦ãã¾ããããã®åå ã¯ã»ã¨ãã©ããã®è¨èªãæ¬æ°ãªãã¯ããã¸ã¼ã¨ãã¦ãã¦ã¯ãããããã¨ã¨ãã¿ã¤ãã³ã°ã«ããã¾ããæè¡çãªåªä½æ§ã¯æéã®çµéã¨ã¨ãã«å¤±ããã¾ããããã¿ã¤ãã³ã°ãããã£ãã ãã§ã¯ãä¸éæ§ã®ãã¼ã ã«çµããããã®ã ã¼ãã¡ã³ãã®éçã¯é·ç¶ããã¾ãããå¾ã£ã¦ããRailsãããã«ãã¦ãé©åãªæè¡ã¨ãã¦ã®ä½ç½®ãç¶æãç¶ãããã ãã§ãªããå½±é¿åã¨ã³ãã¥ããã£ãæ¡å¤§ãç¶ãã¦ããã®ãããããå¤ãã®äººã«èª¬æãã¦ããå¿ è¦ãããã¾ããããã¦ããã®ç¶æã»æ¡å¤§ãå¯è½ã«ãã/ãã¦ããè¦å ã¯ãç©è°ãé¸ããã¨ããããRailsã®åºæ¬ååã«ããã¨èãã¦ãã¾ãã ãã®åºæ¬ååã¯ãã10å¹´ã»ã©ã®éã«é²åãç¶ãã¦ãã¾ããããæãå¼·åºãªæ±ã¨ãªã£ã¦ããã«ã¼ã«ã¯ãã¯ããå ¬éå½åããå¶å®ããã¦ã
ç§ãã¡ã®æä¸ä¸»DHHâ¢ã¯æè¿ã® Full Stack Radioã®ã¤ã³ã¿ãã¥ã¼ ã§ã Basecamp ã®ææ°çã§å½¼ãã©ã®ããã«Railsã®ã³ã³ããã¼ã©ãæ¸ãããã説æãã¦ãã¾ããä¸è¨ã¯ãå½¼ã®ãã°ããã話ãæ¸ãåã£ããã®ã§ãã ããã¾ã§ã«æãããã«ãªã£ã¦ããã®ã¯ããRESTã®ååã«å¾ãã«ã¯ãã©ã®ã¿ã¤ãã³ã°ã§æ°ããªã³ã³ããã¼ã©ãä½ãã¹ãããä¸åº¦æ±ºããããã»ã¼ç°ä¾ãªããã®ååãéµå®ããã¹ãã ãã¨ãããã¨ã§ãããã¤ã ã£ã¦ãã®æ¹ããã¾ããããã§ããèªåã®ä½ã£ãã³ã³ããã¼ã©ã®ç¶æ ãæããã®ã¯æ±ºã¾ã£ã¦ãä½ã£ãã³ã³ããã¼ã©ã®æ°ãå°ãªãããæã§ããå¤ãã®å¦çãä»»ãããã¨ãããã¦ãã¾ããã§ãã ããã§Basecamp 3ã§ã¯ãããç¨åº¦çã«ããªã£ããµããªã½ã¼ã¹ãããã°ãæ¯åã³ã³ããã¼ã©ãåå²ãã¦ããã¾ãããã£ã«ã¿ãªã©ã®å ´åã§ãããä¾ãã°ç»é¢ããã£ã¦ããããããç¶æ ã«ãªã£ã¦ããã¨ãã¾ããããããã«ããã¤ãã®ãã£
3å¹´ã»ã©Railsãæ¸ãã¦ãã¦ããç¨åº¦ç¥è¦ãæºã¾ã£ã¦ããã®ã§ãå¿ããªãããã®ã¡ã¢ã¨ãã¦KPTã¨å°å ¥ä¾ã交ããªãããã©ãã©ã¨æ¸ãã¦ãã¾ãã è¦åºãã®å½åè¦å㯠ã¯ã©ã¹å/ãã£ã¬ã¯ããªåã®åæ°å½¢ãupper camel caseã«ãããã® + KPT ã§ãã Keepã¯ä»å¾ã使ããã®ãProblemã¯éçºè¦æ¨¡ã«ãã£ã¦ã¯åé¡ãçºçãã(ãã)ãã®ãTryã¯ç¾å¨ä½¿ç¨ãã¦ããªãã使ç¨ããã»ããè¯ãã¨æã£ã¦ãããã®ã§ãã ããããã¹ã¦ãå°å ¥ããã°ä¸æãããã¨ããããã§ããªãã®ã§ãéçºè¦æ¨¡ã«åããã¦é©åã«æ¡ç¨ãã¦ããã¨è¯ãã¨æãã¾ãã DDDããã¶ã¤ã³ãã¿ã¼ã³çè¦èãã¯ãã¦ãããã®ã®è©³ããããã§ã¯ãªãã®ã§ééã£ã¦ããé¨åçããã¨ã¯æãã®ã§ãã®è¾ºãã¯ã³ã¡ã³ãã§ãææãé¡ããã¾ãã ã¯ã¦ãã³ã¡ã³ãæ¬ã§é ããææå 容çã«ã¤ãã¦ã¯ã¾ã¨ãã®å¾ã§ã¾ã¨ãã¦è¿çãè¨è¼ãã¦ãã¾ãã Asset (Keep) app/as
ãç¥ãã
é害
ã©ã³ãã³ã°
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}