Rails 3.2.0ãã追å ãããæ©è½3.2.0ãªãªã¼ã¹ãã1å¹´è¿ããã£ã¦ãã¦ã ä»æ´ãªæãã§ãããæè¿ä½¿ã£ã¦ããã©ã¼ãã³ã¹çã«çãæããããã®ã§ã ã¡ããã¨è¨æ¸¬ãã¦ã¿ã¾ããã æ©è½ï¼ç¨éã®èª¬æã¯ããã¡ãã«ãã¾ããã http://d.hatena.ne.jp/hichiriki/20120229â¦
ä¹ ã ã«æ´æ°ãã¾ãããããªãèªåç¨ã®ã¡ã¢ã§ãorz ruby ã ã¨ä»¥ä¸ã®ããã«æ¸ãã®ãperlã§ã©ãæ¸ãã°ããã®ããã # ruby # ç¡åããã·ã¥(ã¨ããå¼ã³æ¹ã§ãããããããªããã©)ãä½æã¨åæã«å¤ãå¼ã£å¼µã {:k1 => 'v1', :k2 => 'v2'}[:k2] # ==> "v2" ä¸å¿ããâ¦
image_tagã§ç»åã表示ããéã«ãsrcã®å¾ãã«ä»ãã¿ã¤ã ã¹ã¿ã³ã㯠åºæ¬çã«ã¯ File.mtime(image_path) ãªã®ã§ãç»åãã¡ã¤ã«ã®æçµæ´æ°æå»ã§ãã image_tag 'rails.png' #=> <img src="/images/rails.png?1298610241" alt="Rails" /> ãªã®ã§ãdevelopementç°å¢ã§ã¯ç»åãã¡ã¤ã«ãtouchãã¦ããããããã¨ãã¿ã¤ã â¦
é常ã«ãããã«ããã¿ã¤ãã«ã§ããã ã¦ã¼ã¶ãããã¹ããã©ã¼ã ã«çµµæåãå ¥ãã¦éã£ã¦ããã¨ãã®è©±ãã§ãã以ä¸ã®ãããªã³ã¼ãããã£ãéã«ã class HogeController < ApplicationController mobile_filter def hoge # ä¾ãã°ããã³ã¢ã®ãæ´ããã«å¯¾å¿ããâ¦
# ruby script/console # æ®éã«æå®ãã¦ãç¡è¦ããã >> User.create(:id => 100) => #<User id: 1, created_at: "2010-12-13 02:47:03", updated_at: "2010-12-13 02:47:03"> # ãããã¯ã§æå®ãã㨠>> User.create do |u| ?> u.id = 100 >> end => #<User id: 100, created_at: "2010-12-13 02:48:22", updated_at: "2010-12-13 02:48:22"> 使ãæ©â¦</user></user>
sqlite3-ruby : version 1.2.5 $ rails testapp1 $ cd testapp1 $ ruby script/generate model user $ rake db:migrate $ ruby script/console >> User.create => #<User id: 1, created_at: "2010-11-25 08:49:43", updated_at: "2010-11-25 08:49:43"> >> User.first.id.class => Fixnum >> User.find(:first, :select =>â¦</user>
params ã ã¨pathãã©ã¡ã¼ã¿ã¾ã§æ··ãã£ã¦ãã®ã§ãã¯ã¨ãªãã©ã¡ã¼ã¿ã ãåãæ¹æ³ãªã©ã調ã¹ã¦ã¿ãã¡ã¢ã hoge ã³ã³ããã¼ã©ã« indexã¢ã¯ã·ã§ã³ãåå¨ãã¦ããç¶æ ã§ã config/routes.rb ã¯ä»¥ä¸ã¨ãã¾ãã ActionController::Routing::Routes.draw do |map| mapâ¦
ããããªæ¸ãæ¹ãæãã¦é ããã®ã§ãã¡ã¢ ãã¨ãã°ãid, name, age, job_id ã¨ãã£ãã«ã©ã ãããªãUserã¢ãã«ããã£ãã¨ãã«ã ç¹å®ã® job_id ã® User ã® id é åã欲ããã¨ããéã«ã©ãæ¸ããã # ãã¨ãã° User.find_all_by_job_id(1)ã§ãããªé åãåãâ¦
session ã®ä¿åæ¹æ³(session_store)ã®éãã«ããããã©ã¼ãã³ã¹(å¦çé度)ãã¹ã
cookie (default), ActiveRecord (:active_record_store), memcached (:mem_cache_store) ãæ¯è¼ããããªããã»ãã·ã§ã³æ°è¦ä½ææ(record insert)ã¨ãæ¢ã«ããã»ãã·ã§ã³ã§ã¢ã¯ã»ã¹ããæãæ¯è¼ããã ç°å¢ findãã¹ãã¨åãã§ããã App Server Amazon EC2â¦
ä¸ã®ãã㪠config/routes.rb ãç¨æãã¦ã routes_check ã® map.connect ãã«ã¼ãã®ä¸ã«æ¸ããã¨ãã¨ã ã«ã¼ãã®ä¸(ã³ã¡ã³ãã¢ã¦ãããã¦ãç®æ)ã«æ¸ããã¨ãã§æ¯è¼ããã ActionController::Routing::Routes.draw do |map| map.connect '/routes_check', :â¦
ç°å¢ ååã®ãã£ã«ã¿ãã¹ãã¨åãã§ããã App Server Amazon EC2: Large Instance Apache: ããã©ã«ãè¨å® Ruby: 1.8.7 Passenger RailsEnv: production RailsMaxPoolSize: 30 RailsPoolIdleTime: 1200 Rails: 2.3.8 Request å ¼ DB Server Amazon EC2: Largâ¦
before_filter, after_filter, around_filter ãææ°éãã¦ã ã©ã®ãããããã©ã¼ãã³ã¹ã«å½±é¿ãåºãã®ãããã£ãã調ã¹ã¦ã¿ã ç°å¢ App Server Amazon EC2: Large Instance Apache: ããã©ã«ãè¨å® Ruby: 1.8.7 Passenger RailsEnv: production RailsMaxPooâ¦
ç»åãæ±ãéã®railsãã©ã°ã¤ã³paperclip GitHub - thoughtbot/paperclip: Easy file attachment management for ActiveRecordåºæ¬çãªä½¿ãæ¹ã¯ãgithubã¨ãç´¹ä»ãã¼ã¸ãåç §ãã¦ãããã¨ãã¦ã ããã§ã¯ç»åä¿åã®ãã£ã¬ã¯ããªåãããã¯ãã¡ã¤ã«åãidé£çªâ¦
æå ã«ããã¹ãã¼ããã©ã³ã®html5対å¿ç¶æ³ããhttp://html5test.com/ ã§ç¢ºèªããã®ã§ã¡ã¢ã iphone4 (4.0.2): Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_2 like Mac OS X; ja-jp) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A400 Safarâ¦
éè¦ããããã¯è¬ã§ãããtitleå±æ§ã«ããã«ã®ã¿ã¤ãã«ãå ¥ã£ã¦ãªãã¦å¾®å¦ã ã¨æã£ãã®ã§ã google ã®æ¤ç´¢çµæã§ãã¿ã¤ãã«ãé·ãã¨éä¸ã§æååãããã¦ããå ´åãããã¾ãã ä¾ãã°ããã®ããã°ã®è¨äºã ã¨ããã¨ãã ããããæååãããã¦ããå ´åã¯ããªâ¦
Resources - Safari - Apple Developer ã® User Control of Downloads Over Cellular Networksãã®é¨å In Safari on iPhone OS (for all devices, including iPad), where the user may be on a cellular network and be charged per data unit, autobufferâ¦
ãããã response.body ã freeze ãããå¾ã«ãæåå¤æãããªãã¨ããã®ã¯ç½®ãã¦ããã¦ãããä¾ãã°ã class HogeController < ApplicationController mobile_filter :hankaku => true around_filter :my_around_filter # mobile_filter 㯠around_filter â¦
before_filter before_filter :b1, :b2 # b1 --> b2 --> action before_filter :b1 before_filter :b2 # b1 --> b2 --> action before_filter + prepend_before_filter before_filter :b1, :b2 prepend_before_filter :b3 # b3 --> b1 --> b2 --> action befâ¦
使ããç¶æ³ãéããã¦ããããjpmobileèªä½ããããããã°ãã¼ãã«å¤æ°ãæ±ããã§ã 極æªãªè§£ã ããä¸å¿ã¡ã¢ãã¦ããã ãã¨ãã°ä¸ã®ããã«ã親ã³ã³ããã¼ã©ã« mobile_filter ãè¨è¿°ãããããç¶æ¿ããåã³ã³ããã¼ã©ãããã¤ãããã¨ãã # 親 class Mobileâ¦
ã¿ã¤ãã«éãã§ãããRT/QT ã¨ããæåå以éãèã(#999999)ããã¹ã¯ãªãããä½ãã¾ããã ä¸è¨ãªã³ã¯å ã®Installãã¿ã³ããã¤ã³ã¹ãã¼ã«ãã¦ãã ããã RT obscure for Togetter for Greasemonkey ãããªæãã§ãã ã2010/07/04 03:08 追è¨ã Toggeter --â¦
JSONæååããªãã¸ã§ã¯ãã«å¤æãã¦ããã JSON.parse() ã使ã£ã¦ã¿ããã ããªã使ãã«ããæããã ã¨ããã®ãã JSON.parse("{hoge: 1}"); // error ãããSyntaxErrorã«ãªã*1 JSON.stringify() ãå³å¯ãªJSONæååãããããããã®ã§ã ã©ãæ¸ãã°ããâ¦
使ãæ©ä¼ã¯ãã¾ãç¡ãæ°ãããããã¡ã¢ãã¦ãã*1 çµè«ããæ¸ãã¨ãã¢ãã«ã¤ã³ã¹ã¿ã³ã¹#attributes ã¨ããã ãã model_instance = Model.new attributes_hash = model_instance.attributes # {"attr1" => "val1", "attr2" => "val2", ...} p attributes_hasâ¦
http://activesfdc.rubyforge.org/ ãå°ã使ãæ©ä¼ããã£ãã®ã§ããã®ã¡ã¢ãã ã¡ãªã¿ã«ãSalesforce ã®ç¥èã¯ã»ã¼ç¡ãç¶æ ã§è§¦ã£ã¦ã¾ãã®ã§ãããããã»ã»ã»ã ãªããrails ã®ãã¼ã¸ã§ã³ã¯ 2.3.5 ã§ãã Setup 㨠HelloWorld ã¿ãããªãã® 1. install å ¬å¼â¦
ã¨ã£ã¦ãç°¡åã§ãï¼Firefox 3.6 ã§åä½ã確èªï¼ã html fileã®ã¢ãããã¼ããã©ã¼ã ã«onchangeãä»è¾¼ãã§ããã¾ãããã¨ã¯ãèªã¿è¾¼ãã ãã¡ã¤ã«ã®å 容ã表示ããtextareaãç¨æã <html> <head> <meta charset="utf-8"> </head> <body> <input type="file" onchange="read(this)" /> <hr /> <textarea id="text" cols="80" rows="20" wrap="off"></textarea> </body> </html>â¦
ç»åããã¬ãã¥ã¼ããããã«ããµã¼ãã¸ã¢ãããã¼ãããå¿ è¦ããªããªãã¾ã*1ã html fileã®ã¢ãããã¼ããã©ã¼ã ã«onchangeãä»è¾¼ãã§ããã¾ãã ãã¨ã¯ããã¬ãã¥ã¼è¡¨ç¤ºç¨ã®è¦ç´ ã ãæºåã <html> <head> <meta charset="utf-8"> </head> <body> <form> <input type="file" name="file" onchange="preview(this)" /> </form> <hr /> <b>preview:</b><br /> <div id="preview_field"></div></hr></body></html>
ã¨ã¦ãç°¡åã html <html> <head> <meta charset="utf-8"> </head> <body> <form action="save.cgi" method="POST" enctype="multipart/form-data"> <input type="file" name="files" multiple /> <input type="submit" value="submit" /> </form> </body> </html> input type="file" 㧠multipleå±æ§ã追å ããã ãã save.â¦
ï¼ï¼åç´ã« obj.property ã§ç¢ºèªããã¨ã»ã»ã» var obj = {}; if (obj.hoge) alert('not exist'); obj.hoge = false; if (obj.hoge) alert('exist false'); obj.hoge = null; if (obj.hoge) alert('exist null'); obj.hoge = undefined; if (obj.hoge) alert(â¦
ãã¼ã«ã«ã§ã¯ãhttp://localhost:3000/ ã§éçºããã¦ãããã æ¬çªãµã¼ãã§åããã¨ãã¯ãhttp://domain/prefix/ ã§åããããå ´åãããã viewã§ãªã³ã¯ãªã©ã®URLãç´æ¸ããã¦ããã¨ãç¸å¯¾ãã¹ãªã大ä¸å¤«ãããããªããã 絶対ãã¹ã¯ prefix ãããããã§ãâ¦
ããããã¨ããããåã«èªåãç¥ããªãã£ãã ãããããã¾ãããã 'hoge'.big() // '<big>hoge</big>' 'hoge'.small() // '<small>hoge</small>' 'hoge'.bold() // '<b>hoge</b>' 'hoge'.italics() // '<i>hoge</i>' 'hoge'.blink() // '<blink>hoge</blink>' 'hoge'.strike() // '<strike>hoge</strike>' 'hoge'.sub() // '<sub>hoge</sub>' 'hoâ¦
canvasã«æããããã¼ã¿ãåå¾ããã«ã¯ãcanvas.toDataURL() ã使ãã¾ãã toDataURL()ã§å¾ãããã®ã¯ãbase64ã¨ã³ã³ã¼ããããç»åæ å ±ãªã®ã§ã ããããµã¼ãã«éã£ã¦ãbase64ãã³ã¼ããã¦ä¿åã¨ããæµãã§ãã toDataURL()ãã¦ããã®ãã¼ã¿ãPOSTããé¨åâ¦