4. @tricknotes I am a software developer who love JavaScript and Ruby. http://tricknotes.hateblo.jp/
4. @tricknotes I am a software developer who love JavaScript and Ruby. http://tricknotes.hateblo.jp/
Ruby Advent Calendar 11æ¥ç® Ruby - Railséçºã§æç¨ãªä¾¿å©Gemä¸è¦§ï¼2013å¹´ç - Qiita âå»å¹´ã®AdventCalendarã§æ¸ããä¸è¨ã®è¨äºã®2014å¹´çã§ãã ã ãã ãæ¯å¹´æä¾çã«ãªã£ã¦æ¥ã¾ããã æè¿ã¯ããã¡ã¯ãã¹ã¿ã³ãã¼ããã»ã¼åºã¾ã£ã¦ãã¦ãããªãæ¯å使ãGemã®ãªã¹ããåºå®åãã¦æ¥ã¾ããã â»2014/12/11æç¹ DBã¢ããã¿ sqlite3 pg mysql2 ãã®è¾ºãã¯ããå¤ãããªãã§ããã RubyãRailsã®ãã¼ã¸ã§ã³ãä¸ãã£ã¦ãç¶ç¶çã«éçºãç¶ãããã¦ããã®ã¯ç´ æ´ãããã¨æãã¾ãã ãã°ã¤ã³èªè¨¼ omniauth omniauth-twitter omniauth-facebook omniauth-github omniauth-identity (omniauth-githubã®ãªãã¸ããªã®URLãå¤ãã£ã¦ã¾ããã
ã¯ããã« ãã㯠ããªã³ã AdventCalendar ã®1æ¥ç®ã§ã ã¯ããã« 1æ¥ç®ï¼ããªã³ã ãæ¯ããä¸éãã¤ã³ãã·ã¹ãã ä¸å¿èªå·±ç´¹ä» ããªãã¥ã¢ãããã å«ã¯ãã¥ã¢ãã¼ã¹ éçºã®èæ¯ ã½ã¼ã·ã£ã«ã²ã¼ã ã®æ´å² ä¸éãã¤ã³ãã«ã¤ã㦠ååéã¨è³é決æ¸æ³ã«ã¤ã㦠æåãã¤ã³ãã¨ç¡åãã¤ã³ã è¤éãªå£²ä¸è¨ç® ããªã³ã ã®ä¸éãã¤ã³ãã·ã¹ãã (dpoint)ã«ã¤ã㦠èªåã®å½¹å² éè¦ãªã㨠dpointãå°å ¥ããã¦ããã¢ã㪠課éããã¼ iTunesã§ã®ä¸éãã¤ã³ãè³¼å ¥ GooglePlayã§ã®ä¸éãã¤ã³ãè³¼å ¥ ãã¤ã³ãæ¶è²» dpointã®ãªãªã¼ã¹ãã¼ã gemã®ããªã¥ã¼ã date_discreterã¨ããgemãä½ãã¾ãã ã©ãããgemï¼ æã®æ¯æãã調ã¹ã æ¥ã®æ¯æãã調ã¹ã æéã®æ¯æãã調ã¹ã dpointæ¹ä¿®æã®ã¤ãã¿ DBã®ã¹ãã¼ãå¤æ´ããå ´åã¯å°å ¥ãã¦ãã¢ããªå ¨é¨ã§ã®å½±é¿ã調ã¹
â質åï¼â Ruby製ãµã¼ããã¼ãã£ã©ã¤ãã©ãªãè¦ã¯gemã§ãä½ã人æ°ãªã®ãã£ã¦ãã¨ãæã£åãæ©ãç¥ããããã§ããã©ã âåçï¼â RubyGems.orgã®statsãã¼ã¸ãè¦ã¦ãã ããã â質åï¼â ãã£ï¼ããã ãï¼ãã®è¾ºã¯ä¸å¹´ä¸ä½ã§åºå®ã§ãããããã¡ãã£ã¨ä¿ºã®ç¥ããªããã©ã¨ãã£ã«å¯ãã ãã®ã«åºä¼ããããã ãã©ã俺ãRailsç¨ãªããã âåçï¼â ã«ãã´ãªã¼å¥ãªãThe Ruby Toolboxãããã¾ãã The Ruby Toolbox - Terminal Coloring â質åï¼â ãããã俺ã®è³ªåã¡ããã¨èãã¦ãã®ï¼ã«ãã´ãªã¼å¥ãªãã¦è¨ã£ã¦ãªãããããã«ãããã®ã«ãã´ãªã¼ã£ã¦ãªãã俺çã«ä¿¡ç¨ãªããã ãããåããã¼ãå¤ãã£ã¦ããã..ã俺ã®gemåºã¦ããªãã£ã¦ããã..ã âåçï¼â GitHubã®Trendingã§ããæè¿ã®äººæ°ãªãã¸ããªãåããã¾ãã Trending
Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? è¿½è¨ Railsã§JSè¾ãåé¡ã«é¢ãã¦ã®çµè«ï¼http://qiita.com/kaiinui@github/items/dad6180f1910c6a4bfd5 -- è¿å¹´ã(1) Web/App両対å¿ãå¢ãã¦ãããã¨ã(2) Webã§ãJSãå¤ç¨ããããã«ãªã£ããã¨ãã®äºã¤ãããã以ä¸ã®ç¹ã§Railsãå¾®å¦ã«ãªã£ã¦ããã Viewã®JavascriptãRailsããç¬ç«ãã¦ãã API層ã®ãµãã¼ããå¾®å¦ æåã«æ¸ãã¦ããã¾ãããç¹ã«æ±ºå®çãªè§£æ±ºçããªããè¾ãããä»å¾è§£æ¶ããã¦ã»ããããããªè©±ã§ãã Viewã®Javascriptã
2013-06-25 Railsãããããªããå«ãã - Rails ã§ã® OO è¨è¨ã«ã¤ã㦠ruby rails æè¿ã¯ãã£ã¨ Rails æ¸ãã¦ããã§ãããæ¸ãã°æ¸ãã»ã©å«ãã«ãªã£ã¦ãããã§ãã å¦æ æçãªãã¤ãªãã§ããã Rails ããã®æªãã¨ããã°ã£ããè¦ãã¦ãã¦ãããä¸ç·ã«ããããªããã§ãã ã§ãå¥ããã»ã©ãããªãã⦠ã¨ããæç´ã«ã¿ãããã Rails ã§ã®è¨è¨ã«ã¤ãã¦ã®è°è«ã§ãã é·ããã©ã³ã¼ãã¯ä¸ååºã¦ããªãã®ã§éå¤ä¸ã«ã§ãããã§ãã ããã 注æ ä¸é¨ã«ã¯ãããè¨èé£ããã§ã¦ããã®ã§ãèªãã§ä¸å¿«ã«ãªãããããã¾ããã ä¸å¿«ã«ãªã£ãã¨ãã¦ã責任ã¯è² ãããã¾ãã 次ã®ãããªæ¹ã®æå¾ ã«æ²¿ãçµè«ã¯ã§ã¾ãããæ®å¿µã§ããã Sinatra, Padrino ã®äºº é¢æ°åã®äºº éçåä»ãã®äºº C ã®äºº TL;DR Rails ã«ã ã¾ãããªãã èªåã®éãè¦å®ããã 欺çã«ã¿ã¡ã Ra
ã¾ã éä¸ã ç°å¢ RVM on Ubuntu 12.04 æºå % ruby -v ruby 1.9.3p362 (2012-12-25 revision 38607) [i686-linux] Ruby gemã®ã¢ããã°ã¬ã¼ã % gem update --system % gem -v 1.8.24 Ruby on Railsã®ã¢ããã°ã¬ã¼ã % rvm gemset use rails3 % gem update rails % rails -v Rails 3.2.11bundlerãèªåã§ã¢ãããã¼ããããªãã®ã§åå¥ã«ã¢ãããã¼ãã % sudo gem update bundler æ¢åã®ããã¸ã§ã¯ãã®ã¢ãããã¼ã Gemfileã®åèã欲ããã®ã§å¥ã«ããã¸ã§ã¯ããçæã % rails new app_3211æ¢åã®ããã¸ã§ã¯ãã app_329 以ä¸ã«ããã¨ãããGemfi
Webã¢ããªã±ã¼ã·ã§ã³ã«ã¤ãã¦ãRESTfulãªURLã»ãªã½ã¼ã¹è¨è¨ã®ãã¿ã¼ã³ãè¦åºããã¨ã§ã ã©ã®ãã¿ã¼ã³ããå¤æããã ãã§ãæ¢åã® Good Practice ãé©ç¨ã§ãã ååãã¤ãã¦å¼ã¹ãããã«ããã Railsãªã©ã®ãã¬ã¼ã ã¯ã¼ã¯ã§ç°¡åã«é©ç¨ã§ããããã«ããã ã¨ãããã¨ãç®æãã¦ãã¾ãã ã»ãã¨ãã«å½¹ç«ã¤ã ããã¯ãã¿ã¼ã³ã¨è¨ããã®ã ãã£ã¨ä»ã«ããã ã ãã¶ç²åº¦ããã©ãã© ååã®ä»ãæ¹ï¼ãã¿ã¼ã³ã¯ååéè¦ï¼ ãªã©ããã²ãæè¦ããã ããã ãã¿ã¼ã³ Collection & Member Resource ãã¿ã¼ã³ Singular (Singleton) Resource ãã¿ã¼ã³ Filtered Collection ãã¿ã¼ã³ Filtered Subresource ãã¿ã¼ã³ Multi-member Resource ãã¿ã¼ã³ Partial Resource ãã¿ã¼
æ¬æ¥ã¯ Google Gears é¢é£ã®ããã²ã¨ã¤ã®ãã¿ãæ¸ããã¨æã£ãã®ã§ãããéã«åããªãã£ãã®ã§æè¿ä»äºã§ä½¿ã£ã Apache ã®ãªãã¼ã¹ãããã·æ©è½ã®è¨å®æ¹æ³ãªã©ããç´¹ä»ãã¾ãããªãã¼ã¹ãããã·ã¯ãç¹å®ã®ãã£ã¬ã¯ããªä»¥ä¸ã¸ã®ãªã¯ã¨ã¹ããä»ã® Web ãµã¼ãã¼ã«ä¸ç¶ããæ©è½ã§ãã LAN å ã®è¤æ°ã®ãã·ã³ã§ç¨¼åãã¦ãã Web ãµã¤ããã²ã¨ã¤ã®ã°ãã¼ãã« IP ã§å ¬éãããã Apache 以å¤ã® Web ãµã¼ãã¼ï¼Rails ã§ãã使ããã mongrel ã¨ãï¼ã Apache ã® Web ãµã¤ãã«çµ±åãããã¨ããç°¡åã«ã§ãã¾ãã Web ãµã¤ããæè»ã«æ§ç¯ããããã«ãè¦ãã¦ããã¨ä¾¿å©ã§ããã åææ¡ä»¶ Apache ã®ãªãã¼ã¹ãããã·æ©è½ãå©ç¨ããããã«ã¯ã mod_proxy ãçµã¿è¾¼ãã Apache ãå¿ è¦ã§ããé常㮠Linux ãã£ã¹ããªãã¥ã¼ã·ã§ã³ãªã©ã§ã¯ããã©ã«ã
selinuxãEnforcingã«ããFedora 10ã§ãpassenger(mod_rails for Apache)ãåããæ¹æ³ãè¨è¿°ãã¾ãã åä½ç¢ºèªããç°å¢ã¯æ¬¡ã®ã¨ããã§ãã OSï¼Fedora 10 Selinux: Enforcing passengerï¼2.1.2 å ¨ä½ã®æé ã¯ä»¥ä¸ã®ã¨ããã§ãã selinuxé¢é£ã®å¿ è¦ãªããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã« passengerç¨ã®selinuxã®ããªã·ã¼ãã¤ã³ã¹ãã¼ã« passengerã®ã¤ã³ã¹ãã¼ã« httpdãèµ·å 1. selinuxé¢é£ã®å¿ è¦ãªããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã« $ yum install selinux-policy selinux-policy-targeted 2. passengerç¨ã®selinuxã®ããªã·ã¼ãã¤ã³ã¹ãã¼ã« 1)passengerãå©ç¨ããselinuxã®ããªã·ã¼ãä½æ $ mkdir /et
ã¢ã¼ã¯ã¦ã§ãã·ã¹ãã éçºSandBox Webå¶ä½ä¼ç¤¾ã¢ã¼ã¯ã¦ã§ãã®ã¹ã¿ããããã·ã¹ãã éçºã®Tipsã»ãã¦ãã¦ãã¾ã¨ãã¦ããWikiã§ã ã¢ã¼ã¯ã¦ã§ãã·ã¹ãã éçºSandBox ã¢ã¼ã¯ã¦ã§ãWebãã¼ã±ãã£ã³ã°SandBox ã¢ã¼ã¯ã¦ã§ãWebãã¶ã¤ã³SandBox ã¢ã¼ã¯ã¦ã§ã ã¢ã¯ã»ã·ããªãã£Wiki http://www.ark-web.jp/sandbox/wiki/284.html ããã ] [ ç·¨é | åçµ | å·®å | ããã¯ã¢ãã | æ·»ä» | ãªãã¼ã ] [ æ°è¦ | ä¸è¦§ | åèªæ¤ç´¢ | æçµæ´æ° | ãã«ã ] DBã®èª¿æ´ããã â è¨å®ãã¡ã¤ã«ãå¤æ´ãã¾ã $ vi config/database.yml production: adapter: mysql database: <DBå> username: <DBã¸ã®ã¦ã¼ã¶å> password: <D
ãããVPS 2GB SSDã®CentOS 6.4ãã»ããã¢ãããã¦ã¤ã±ã¦ããRailsãµã¼ãã«ä»ä¸ããã¾ã§ã®ã·ãªã¼ãºã§ãã第7åã¯RVM(Ruby Version Management)ãã¤ã³ã¹ãã¼ã«ããæé ã§ããRVMã¯Rubyã®ãã¼ã¸ã§ã³ã管çãã¦ãããããã¿ã§ã²ã¨ã¤ã®ãµã¼ãã§è¤æ°ã®ãã¼ã¸ã§ã³ã®Rubyã使ãå¯è½æ§ãããå ´åã«ä½¿ãã¨ãªã¹ã¹ã¡ãªãã¼ã«ã§ãã
Rails3 ã§ã¯ãmodel ã« scope :origin, ->(lat,lng){ factor=Math.cos(lat/180*Math::PI) select([table_name+".*", sanitize_sql_array(["111.11*GLength(LineString( point(?,?), point(x(geom)*?,y(geom)) )) AS distance", lng*factor, lat, factor])]) } ã¨ãã¦ããã¦ã Location.origin(lat,lng).order("distance") ã¨ãã Location.origin(lat,lng).where("'distance' < ?", dist) ã¨ãã è¨ç®å¼ã¯ä½ããã¦ããã¨ããã¨ãã¾ããä¸å¿å°ç¹ã®ç·¯åº¦ããããã®å°ç¹ã«ããã緯度ã¨çµåº¦ã®é·ãã®æ¯ãç®åº
ãæ¹è¨æ°çãåºç¤Ruby on Railsããèªè ãµãã¼ããã¼ã¸ > Railsæ¬çªç°å¢æ§ç¯ã¬ã¤ã 以ä¸ãMySQLãã¤ã³ã¹ãã¼ã«ãã¦ãRailsã¢ããªã±ã¼ã·ã§ã³ããæ¥ç¶ããã¾ã§ã®æé ã示ãã¾ãã ãªã¢ã¼ããã·ã³ã«sudo権éãæã¤ã¦ã¼ã¶ã¼ã§SSHæ¥ç¶ããã³ãã³ããé ã«å®è¡ãã¦ãã ããããªãã% ã¯ã³ãã³ãããã³ããã$ ã¯MySQLã¢ãã¿ã¼ã®ããã³ããã示ãã¾ãããããã®æåã¯å ¥åããªãã§ãã ããã MySQLãµã¼ãã®ã¤ã³ã¹ãã¼ã« CentOS 6.2 % sudo yum install -y mysql-server mysql-devel
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}