You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
ã¯ã©ã¦ãã¯ã¼ã¯ã¹ã®ã¨ã³ã¸ãã¢ã®æ£®ç°ï¼@minamijoyoï¼ã§ãã ã¤ãã«Rails5ããªãªã¼ã¹ããã¾ããããä»æ¥ã¯Rails5ãããªãã§ããã©ãRails3/4並è¡ç¨¼åããã話ããããã¨æãã¾ããRailsãã¼ã¸ã§ã³ã¢ãããæ¤è¨ãã¦ããæ¹ã ã®åèã«ãªãã°å¹¸ãã§ãã ã¯ããã« å»ã2016/03/28 ãRails Upgrade Casual Talksãã¨ããã¤ãã³ãã§Rails3/4並è¡ç¨¼åãããä»çµã¿ãä½ã£ã¦ã話ããã¾ããã ã¤ãã³ãã®æ¨¡æ§ã¯ã¨ã³ã¸ãã¢ããã°ã«ãã³ãã(@ctokoro_me)ãã¾ã¨ãã¦ããã¦ãã®ã§ãã¡ããåç §ãã¦ä¸ããã engineer.crowdworks.jp ä¸è¨ã®ã¤ãã³ãã§çºè¡¨ããå 容ã¯ãã¡ãã§ãâ Railsãã¼ã¸ã§ã³ã¢ããã段éçã«è¡ãããã«Rails3/4並è¡ç¨¼åãããä»çµã¿ãä½ã£ã¦ã話 from Masayuki Morita www.slide
ããã«ã¡ã¯ããã¬ã³ã調æ»ã©ãã®äºä¸å¯ä¹ï¼@inohiroï¼ã§ãã æ®æ®µã¯ãã¯ãã¯ãããã®æ¤ç´¢ãã°ãåºã«ããæ³äººåããã¼ã¿ãµã¼ãã¹ããã¹ã¿ããã®éçºãã åºåäºæ¥å¨è¾ºã®ãã¼ã¿åæãªã©ãæ å½ãã¦ãã¾ãã Amazon Redshiftãªã©ã®ãã¼ã¿ãã¼ã¹ã«èç©ããããã°ãªã©ã®å¤§éã®ãã¼ã¿ã«å¯¾ãã¦ã æ¥æ¬¡ãé±æ¬¡ãªã©ã®åä½ã§ãããå¦çãè¡ã£ã¦ããæ¹ã¯å¤ãããã£ãããã¨æãã¾ãã ãã°ãªã©ãæ±ããããå¦çã§ã¯ãå¦ç対象ãè¨å¤§ã§ããã¨ã¢ããªã±ã¼ã·ã§ã³ã使ãã¡ã¢ãªãå¢å¤§ãã æ¯æ¸ãã¦ãã¾ãæããããããããã¼ã¿ã®æ±ãã«æ°ãã¤ããå¿ è¦ãããã¾ãã ãã¼ã¿ãã¼ã¹å ã§å®çµãããããå¦çãªãã°ããã¾ã§æ°ã«ããå¿ è¦ã¯ç¡ãããããã¾ãããã å¤é¨ã®ããã°ã©ã ãããã¼ã¿ãèªã¿åºãã¦å¦çããå ´åã¯ç¹ã«æ³¨æãå¿ è¦ã§ãã ããã§èããããä¸ã¤ã®å·¥å¤«ã¨ãã¦ãå¦ç対象ãåå²ãã¦ãç¹°ãè¿ãã¦å¦çãè¡ãæ¹æ³ãæãããã¾ãã ä¸è¬çãª
cuzic ã§ãã Ruby on Rails Advent Calendar 24æ¥ç®ã®è¨äºã§ãã ä»æ¥ã¯ã¯ãªã¹ãã¹ã¤ãã§ãã å®ã¯çã¾ãã¦åãã¦ã® Advent Calendar ã¸ã®æ稿ã§ãã ããã« Qiita ã§æ¸ããã®ãåãã¦ã§ãã ã¡ãã£ã¨ããããã§ãã ä»æ¥ã¯ãRuby on Rails ã«ããã Conditional Get ã« ã¤ãã¦æ¸ãã¾ãã ConditionalGet ã¨ã¯ ããã§æ¸ããã¨ãã¦ãã ConditionalGet ã¨ã¯ã HTTP1.1 ã§è¦å®ããã¦ããåå¾æ¸ã¿ã®ã³ã³ãã³ãã§ããã° ãã©ã¦ã¶å ã®ãã¼ã«ã«ãã£ãã·ã¥ã使ããããã¨ã§ã ãã©ãã£ãã¯éãåæ¸ããæ©è½ã®ãã¨ã§ãã ä¸è¬ã«ããã©ã¦ã¶ã¯åä½ãé«éåããããããã©ãã£ãã¯ã 軽æ¸ãããããã³ã³ãã³ããä¸æ¦ãã£ãã·ã¥ã¨ãã¦ä¿ç®¡ãã¾ãã ã¨ã¯ããããã£ãã·ã¥ã使ãéãããã®ãã£ãã·ã¥ã¯ä»ã§ã æå¹ãª
ãããã§ããRubyKaigi 2013ã®ä¼å ´ããããã«ã¡ã¯ã ç¾å¨ãå¼ç¤¾ã§éçºä¸ã®qnypã¨ãããµã¼ãã¹ã¯ãå°ãåã«Rails 3.2.13ããRails 4.0.0.rc1ã¸ã¨ã¢ãããã¼ããè¡ãã¾ããï¼ãµã¼ãã¹èªä½ã¯ã¾ã éå ¬éãªã®ã§ã¢ã¯ã»ã¹ã¯ã§ãã¾ããï¼ã ãã®ã¢ãããã¼ãä½æ¥ãéãã¦ã Railsã«ä¾åããgemãæ¸ããã¦ãã JavaScriptã©ã¤ãã©ãªãã©ããããã ãã®gemã使ããªãããã«ãã ã¨ããç¹ã«ã¤ãã¦éè¦ããããã«ãªãã¾ããã 1. Railsã«ä¾åããgemãæ¸ããã¦ãã ç¹ã«ActiveRecordãªã©Railsã®å é¨ã«æ·±ãé¢ãããããªgemã«ããã¦ãRailsã®ã¡ã¸ã£ã¼ã¢ãããã¼ãæã®å¯¾å¿é度ãè¿ éã§ã¯ãªããããªãã®ããã£ããããã§ããã ããããã®gemãå©ç¨ããªãããã«ãªãã¾ãããä¾ãã°auditedã¯ãç¾æç¹ã®ææ°çãactiverecord ~> 3.0
ãã®è¨äºã¯ ãã¯ã³ã´ Advent Calendar 2014 20æ¥ç®ã®è¨äºã§ã æ°ããå¹´ãè¿ããæºå ãããã¨10æ¥ããããæ°å¹´ã§ãã ã¿ãªããæ°å¹´ãè¿ããæºåã¯ã§ãã¦ããã§ãããã? ã? ãã®åã«å¤§äºãªã¤ãã³ã? ã³ãã±ã®ãã¨ããª??? æ£æã®æºåã¨ããã°ã家ã大æé¤ãããã飾ããéæ¾ã飾ããé¤ ãæããããã¡ãä½ããè²ã ããã¾ããã ããã¯ãã¹ã¦ç¥æ§ãè¿ãå ¥ããããã®æºåãªãã§ããã å¹´ç¥æ§ã¨ãããå æ¥ã«å家ã«è¨ªããä¸å¹´ã®å®ãã¨å¹¸ããããããã¦ããããããããç¥æ§ã§ãã å¹´ç¥æ§ãå¿ããæè¿ãã失礼ãªãããããã¦ãªãããã°ã次ã®ä¸å¹´ã®å¹¸ç¦ã¨ç¹æ ã¨ããã¿ã¤ãºã¯ç´æããããåç¶ã§ãã ãã¦ãä»å¹´ã¯ãRailsã¨ã³ã¸ãã¢ãå¹´ç¥æ§ããè¿ãããã«ããã£ã¦ã ãã®åã«ä¾ç©ãæ§ãèã¶ãç¾ä¸ç¥ã®æããé®ããªããã°ãªãã¾ããã ããªãã¡ãä»å¹´ã®ãã¡ã« secureå±æ§ãã¤ããcookie ãç¾ä¸ç¥ã«ã
Railsã®Migrationã®åºæ¬çãªãã¨ãããã«ã©ã 追å /åé¤ãã¤ã³ããã¯ã¹è¿½å ãNULLå¶ç´ãã«ã©ã åå¤æ´ãªã©ã®ã¬ã·ãéãã¾ã¨ãã¾ããã åä½ç¢ºèª Rails 4.1 ç®æ¬¡ 1. Migrationã®åºç¤ 1.1. migrationãã¡ã¤ã«ã®ä½æ 1.2. ãã¤ã°ã¬ã¼ãã®å®æ½ rake db:migrateã³ãã³ã 1.3. ãã¤ã°ã¬ã¼ãã®é©ç¨ç¶æ³ç¢ºèª rake db:migrate:statusã³ãã³ã 1.4. ãã¼ã¿ã®æå ¥ rake db:seedã³ãã³ã 1.5. ãã¤ã°ã¬ã¼ã·ã§ã³ã§ä½¿ãããã¼ã¿åä¸è¦§ 2. Migrationã®ã¬ã·ãé 2.1. ã«ã©ã ã®è¿½å ï¼add_columnï¼ 2.2. ã«ã©ã ã®åé¤ï¼remove_columnï¼ 2.3. ãã¼ã¿åã®å¤æ´ï¼change_columnï¼ 2.4. ã¤ã³ããã¯ã¹ãã¦ãã¼ã¯å¶ç´ã®è¿½å /åé¤ï¼add_index/remove
Ruby 5ã§ç´¹ä»ããã¦ããObject Oriented Rails - Writing better controllers - Pivotal Labsã®è¨³ã§ãã(翻訳ã®è³ªã¯ãããããããã¾ãããå è¨äºèªã¿ã¾ããã) ç§ã¯æè¿ãObjective-Cã使ã£ã¦iOSãJavaã使ã£ã¦Androidãããããã®ã¢ãã¤ã«éçºããã¦ããã ç§ã¯Rubyéçºè ã§ãããã®ã§ããããã®è¨èªããã¬ã¼ã ã¯ã¼ã¯ããå¦ãã ãã¨ãå¯è½ãªéãRubyã§ã試ããé©ç¨ãã¦ã¿ããã¨ããã®ã¯å½ç¶ã®ãã¨ã ããã ä»æ¥ã¯Railsã¢ããªã§ããããã³ã³ããã¼ã©ãæ¸ããããåã®ãã¹ããå°½ãããã¨æãã ç§ã¯AndroidãiOSåãã®ã¢ããªãæ¸ãã¨ããã¹ã¿ããã¢ãã¯ã使ããªããããèªåèªèº«ã«å¼·å¶ãã¦ãããããã¯ããªãã¸ã§ã¯ãã®è¨è¨ãåä¸ãããDI(ä¾åæ§ã®æ³¨å ¥)ã使ã£ã¦ãã¹ããæ¸ããã¨ãæå³ãã¦ããã ã§ã¯ãã³ã¼ãã®ä¾ãè¦ã¦
options = { type: method || 'GET', data: data, dataType: dataType, // stopping the "ajax:beforeSend" event will cancel the ajax request beforeSend: function(xhr, settings) { if (settings.dataType === undefined) { xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); } return rails.fire(element, 'ajax:beforeSend', [xhr, settings]); }, success: function(data, status, xhr) { elemen
æ¦è¦ é常 Rails ã® flash ã¡ãã»ã¼ã¸ã¯ãã¢ã¯ã·ã§ã³ãã¨ã« HTML ãã¬ã³ããªã³ã°ããå ´åã«ãã使ç¨ã§ãã¾ããã Rails å´ã®åã¢ã¯ã·ã§ã³ã§ flash ã¡ãã»ã¼ã¸ã®è¨å®ãè¡ãå¿ è¦ãããããã§ãã ã¤ã¾ããAjax éä¿¡ãçµäº (complete) ããéã« flash ã¡ãã»ã¼ã¸ã表示ããæ段ã¯ãããã©ã«ãã§ã¯ç¨æããã¦ãã¾ããã ä¸å¿ããµã¼ãå´ã§ flash ã¡ãã»ã¼ã¸ã表示ããããã® JavaScript ãç¨æãã¦ããããã¬ã¹ãã³ã¹ã¨ãã¦è¿ããªã©ã®æ¹æ³ã¯ããã¾ãã ããã§ã Ajax éä¿¡ (JSON ãªã¯ã¨ã¹ã) ã§ã flash ã¡ãã»ã¼ã¸ã表示ãããããï¼ ã¨ããããã§ãã®æ¹æ³ã調ã¹ã¦ã¿ã¾ããã æ¹æ³ Rails å´ã§ã¯ã¬ã¹ãã³ã¹ããã ('X-' ã§å§ã¾ãã«ã¹ã¿ã ããã) ã« flash ã¡ãã»ã¼ã¸ãæ ¼ç´ãã¦ã¬ã¹ãã³ã¹ãè¿ãã¾ãã ããã¦ãJavaScri
Twitter ããã®ã¬ã¹ãã³ã¹ãã¼ã¿ã大ããã®ãåå åå ã調ã¹ãã¨ãããOAuth èªè¨¼ã§ãTwitter ãè¿ãã¬ã¹ãã³ã¹ãã¼ã¿ã® extra section ã®ãã¼ã¿ã大ããããããã§ãããããã ruby on rails â Devise for Twitter, Cookie Overflow error? â Stack Overflow 解決çãã°ã°ã£ã¦ã¿ãã®ã§ããã©ãã»ãã·ã§ã³ã®ä¿åå ã Cookie ãã ActiveRecord ã«å¤æ´ããæ¹æ³ã解説ãã¦ãããã¼ã¸ãå¤ãã£ãã ã»ãã·ã§ã³ã«ãã¾ã大ããªãã¼ã¿ãæ ¼ç´ããã®ãæ°æã¡æªãæ°ãããã®ã§ããã® stackoverflow ã«æ¸ãã¦ãã£ãæ¹æ³ã§ extra ã¯ã»ãã·ã§ã³ã«æ ¼ç´ããªãããã«ãã¾ããã OAuth èªè¨¼ç¨ã®ã³ã¼ã«ããã¯ã¡ã½ãã 以ä¸ãDevise + OmniAuth ã使ã£ã OAuth èªè¨¼ç¨ã®ã³
Railsã§ãã¼ã¸ãã¨ã«ãã¼ã¸ã¿ã¤ãã«(titleã¿ã°)ãå¤æ´ããTipsã説æãã¾ãã åä½ç¢ºèª Rails 4.1 1. ã¿ã¤ãã«ãè¨å®ãããã«ãã¼ã¡ã½ãããä½æ ã¿ã¤ãã«ãè¨å®ããã¡ã½ããã追å ãã¾ãã page_titleãããã®å ´åãbase_titleãã表示ããªãããã«ãã¦ãã¾ãã # app/helpers/application_helper.rb module ApplicationHelper def full_title(page_title) base_title = "ã¢ããªå" # èªåã®ã¢ããªåãè¨å®ãã if page_title.empty? base_title else "#{page_title} | #{base_title}" end end end 2. ã¬ã¤ã¢ã¦ãã®>title<ã¿ã°ãããã«ãã¼ã¡ã½ããã使ã ã¬ã¤ã¢ã¦ããã¡ã¤ã«ã®title
æ´ç ã¾ããããã¾ã§ã§ä¸æ¦æ´çããã Time.nowã¯Rubyã®çµã¿è¾¼ã¿ãªã®ã§ã·ã¹ãã ã®ã¿ã¤ã ã¾ã¼ã³ããè¦ãªããOSã®æéã¨å¸¸ã«ä¸è´ãããTime.localã®åºåçµæãOSã®ã¿ã¤ã ã¾ã¼ã³ã¨ä¸è´ããã TimeWithZoneã¯ã©ã¹ã¯config.time_zoneã«å·¦å³ãããã Rubyçµã¿è¾¼ã¿ã®ã¡ã½ããã§åå¾ããUTCã®æéãåºæºã«ãè¨å®ããã¦ããã¿ã¤ã ã¾ã¼ã³ã®æéã«å¤æããã ActiveRecordã®ã¤ã³ã¹ã¿ã³ã¹ã«å¯¾ãã¦ã¢ã¯ã»ãµãå©ç¨ãã¦æéãããåãããå ´åã¯TimeWithZoneã§è¡ãããã ä»®ã«Timeã¯ã©ã¹ã渡ãã¦ãä»£å ¥æã«TimeWithZoneã«å¤æãããã config.active_record.default_timezoneã®è¨å®ã¯DBãèªã¿æ¸ãããéã«ãDBã«è¨é²ããã¦ããæéãTime.utcã§èªããTime.localã§èªãããè¨å®ããã :utcã®å ´
# [åæ] # 以ä¸ã®æ§ãªãã¼ã¿ãæã¤usersãã¼ãã«ãä½æããã¦ããã¨ããã # | id | name | # | 1 | taro | # | 2 | hanako | require 'active_record' # ããã¯ä½¿ç¨ããDBã«ãããã(ãã®ä¾ã§ã¯SQLite3) ActiveRecord::Base.establish_connection( "adapter" => "sqlite3", "database" => "./hoge.sqlite3" ) # åãã¼ãã«ã®Modelãåçã«ä½æãã ActiveRecord::Base.connection.tables.each do |table_name| class_name = table_name.singularize.camelcase self.class.const_set class_name
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}