ç¾å¨ãã·ã¹ãã ã¡ã³ããã³ã¹ä¸ã§ã 2008/6/8ï¼æ¥ï¼åå01:00ã18:00 ã¡ã³ããã³ã¹ã®ãã SFC-GC ã®å ¨ãµã¼ãã¹ãåæ¢ããã¦ããã ãã¾ãã ãè¿·æãããããããã¾ãããååãé¡ããããã¾ãã Copyright(c) 2002-2008, Keio University Shonan Fujisawa Campus. All rights reserved.
Twitterã®APIã§Railsã®Active Resouceã試ãã¦ã¿ã http://blog.tkmr.org/tatsuya/show/318-twitter-api-rails-active-resouce ã®å½±é¿ãåãã¦ActiveResourceã使ã£ã¦ã¿ãã ä¸ã®è¨äºã¨åããã¦æã£ããã¨ãã¤ãã¤ãã¨æ¸ãã¾ãã å¤ãã®å ´åæ¸ãã¯ã©ã¹ã®è¨å®ã¯å ±éãã¦ããã®ã§ãµã¤ããã¨ã«ãã¼ã¹ã®ã¯ã©ã¹ãç¨æãã¦ãã£ã¦å°ã¯ã©ã¹ã¯ãããç¶æ¿ãã¦ãã£ã¦ãã使ãæ¹ãè²ã ã¨æ¥½ã§ããã¨æããã¤ã¾ãä¸ã®è¨äºã®ä¾ãªãã require 'highline' require 'logger' class Twitter::API < ActiveResource::Base USER = HighLine.new.ask('user:') PASSWD = HighLine.new.ask('passwd:')
å æ å ±ã¯1é±éåãªã®ã§ãæ¡ããã¦ããªãã¿ã§ã¯ãªããã©ãITproã«ãã£ãè¨äºãä½æ°ãªãçºãã¦ãã¦è¦ã¤ããã®ãããã親è¨äºã¯ã ãæ¥æ¬Rubyã«ã³ãã¡ã¬ã³ã¹2006ãã趣å³ã®è¨èªãããã¸ãã¹ã®è¨èªã¸ã---æ¥æ¬åã®Ruby大è¦æ¨¡ã¤ãã³ãéå¬ãããã ç»åãæ¶ããã¨å°ãã®ã§(ãã¶ãæ¶ããªãã¨ã¯æããã©)ãä¸èº«ã転è¼ã Person = ActiveResource::Struct.new do |p| p.uri = "http://www.example.com/people" p.credentials :name => "dhh", :password => "secret" end david = Person.new(:name => "David") # POST http://www.example.com/people # <person><name>David</name><
ActiveResource ãã¤ã³ã¹ãã¼ã«ããã $ gem install activeresource --source http://gems.rubyonrails.org -y ã¤ãã§ã« Beta Gems ãã¤ã³ã¹ãã¼ã«ãã¦ããã¨ããããã¼ã¸ã§ã³ãæãã®ã§ã $ gem update --source http://gems.rubyonrails.org -y ãµã³ãã«ã¢ããªãä½æããã database 㯠Sqlite3 ã«ãã¦ããã $ rails demo -d sqlite3 ã¾ãå®ç´ã« generate scaffold_resource ã§ä½æã $ script/generate scaffold_resource post title:string created_on:date body:text published:boolean $ rake db:
= Active Resource Active Resource (ARes) connects business objects and Representational State Transfer (REST) web services. It implements object-relational mapping for REST webservices to provide transparent proxying capabilities between a client (ActiveResource) and a RESTful service (which is provided by Simply RESTful routing in ActionController::Resources). == Philosophy Active Resource attem
= Active Resource Active Resource(ARes)ã¯ããã¸ãã¹ãªãã¸ã§ã¯ãã¨ãRepresentational State Transfer(REST)Webãµã¼ãã¹ããæ¥ç¶ãã¾ããéæãªãããã·æ©è½ãã¯ã©ã¤ã¢ã³ã(ActiveResource)ã¨RESTfulãµã¼ãã¹(ActionController::Resourceã®ä¸ã§ã·ã³ãã«ãªRESTã«ã¼ãã£ã³ã°ãæä¾ããã)ã®éã«æä¾ããããã¨ã«ãã£ã¦ãRESTãªWebãµã¼ãã¹ã®ããã®ãªãã¸ã§ã¯ãé¢é£ãããã³ã°ãå®è£ ããã¾ãã == å²å¦ Active Resourceã¯ãRESTãªWebãµã¼ãã¹ã®ããã®è«ççãªãªãã¸ã§ã¯ãé¢é£ãããã³ã°ã®ã©ããã¼ãæä¾ãããã¨ã試ã¿ã¾ããããã¯ãActive Recordã®ä¸»è¦ãªç®çã®ä¸ã¤ã§ããããããªã½ã¼ã¹ã«ãããããå¿ è¦ãããã³ã¼ãã®éãåæ¸ãããã¨åãå²å¦ã«å¾ãã¾ããããã¯
â [rails] Validations ãã ActiveRecord ãªãã¸ã§ã¯ãã®å é¨ç¶æ ãæå¾ ããå¤ãã©ãããæ¤æ»ããã®ãvalidation æ©è½ã§ããä¾ãã°ãããå¤æ°(ç¶æ )ãã空å¤ã決ã¾ã£ãç¯å²ãç¹å®ã®æ£è¦è¡¨ç¾ã«ããããã§ãããã©ããã¨ãã£ãæ¤æ»ãå®ç¾©ãã¾ããå®ç¾©ããã«ã¯ãActiveRecord::Base#validate ã override ãã¾ããvalidate_on_create ã validate_on_update ãªã©ã«é¢ãã¦ãåæ§ã§ãã validate_on_create: ãªãã¸ã§ã¯ããæ°è¦ã«ä½æãããã¨ãã«ã®ã¿å®è¡ããã¾ã validate_on_update: ãªãã¸ã§ã¯ããæ´æ°ãããã¨ãã®ã¿å®è¡ããã¾ã validate: æ°è¦ã»æ´æ°ã®ã©ã¡ãã®å ´åã§ãå®è¡ããã¾ã validate 㨠validate_on_* ã®ä¸¡æ¹ãå®ç¾©ãããå ´åã¯ã
# File activerecord/lib/active_record/validations/absence.rb, line 20 def validates_absence_of(*attr_names) validates_with AbsenceValidator, _merge_attributes(attr_names) end Validates whether the associated object or objects are all valid. Works with any kind of association. class Book < ActiveRecord::Base has_many :pages belongs_to :library validates_associated :pages, :library end WARNING: This
By Wyatt Andrews March 22, 2008 / 11:26 PM EDT / CBS Imagine re-growing a severed fingertip, or creating an organ in the lab that can be transplanted into a patient without risk of rejection. It sounds like science fiction, but it's not. It's the burgeoning field of regenerative medicine, in which scientists are learning to harness the body's own power to regenerate itself, with astonishing result
RSpec on Railsã®ãããã ãã ããã°ããªããä»é ãBDD(Behaviour Driven Development)ãç¥ãã¾ããããã ããããã¯ãã¡ãã¨BDD or TDDã§éçºãé²ãã¾ãã BDDã¯ãã¹ãé§åéçºã¨è¨èã®è¨ãåãã大ããç°ãªã£ã¦ããã ãããã¤ãã¢ãæ¸ãã¦ä»æ§ãè¨è¨ããããããã大ããªããªã·ã¼ã BDDã§ã¯å¿ ãä»æ§ã³ã¼ã(spec)ãæ¸ãã¦ããå®éã®ã³ã¼ãã£ã³ã°ãè¡ãã Rubyã«ã¯ãRSpecã¨ãããã¼ã«ããããããå©ç¨ããã gemããã±ã¼ã¸ãç¨æããã¦ããã®ã§ç°¡åã $ gem install rspec 次ã«RSpec on Railsãã©ã°ã¤ã³ãã¤ã³ã¹ãã¼ã«ã REL_X_Y_Zã®é¨åãrspecã®ãã¼ã¸ã§ã³ã¨ããããå¿ è¦ãããã $ cd RAILS_ROOT $ ruby script/plugin install svn://rubyfor
ååtoytterã«rails2.0ãªãã§ã¯ã®æ©è½ãå ¥ãã¦è¡ãã¨è¨ãã¾ããããæ¡å¼µãã¦ããããªããã¹ãã¯ç¡è¦ã§ããªãããã¨ããããªãã®å¯ãéã§ãã railsã«ã¯æåãããã¹ããããããã®æ çµã¿ãç¨æããã¦ãã¦ãããªããã¹ãã¸ã®æ·å± ã¯ä½ããªã£ã¦ãããã§ãããããã¨ã¯å¥ã«RSpec on Railsã¨ãããã®ã使ããã¨ãã§ãã¾ãã ãã®RSpecããã£ã¦ããããã¨ã¯Test::Unitã¨åãããã¹ãããªãã§ãããé常ã«æ°æã¡ãããã¹ããæ¸ããã¨ãã§ãã¾ããç¹ã«TDD(ãã¹ãé§åéçº)ããã£ã¦ãããããããã£ã¦äººã«ã¯ãå§ãã§ã ãã¡ãã®ãã¼ã¸ã§ã¨ã¦ããããããã解説ãã¦ããã¦ãã¾ãã ã¹ã¯ã¹ããã¯ã®ã¹ã第ï¼åã ã§ã¯æ©éãtoytterã§ãrspecã使ããããã«ãã¾ãã ã¤ã³ã¹ãã¼ã«æ¹æ³ã¯ $ gem install rspec $ ./script/plugin install http:
ããã³ã¾ãã¯ãRuby ã«é¢ããæè¡è¨äºã¯ãã¡ããã®ãã¨ãRubyist ã¸ã®ã¤ã³ã¿ãã¥ã¼ãã¨ãã»ã¤ããã®ä»ããå±ãããã¦ã§ãéèªã§ãã Rubyist Magazine ã«ã¤ã㦠ãRubyist Magazineããç¥ãã¦ããã³ã¾ãã¯ãæ¥æ¬ Ruby ã®ä¼ã®æå¿ã«ãã Rubyist ã® Rubyist ã«ãããRubyist ã¨ããã§ãªã人ã®ããã®ã¦ã§ãéèªã§ãã ææ°å· Rubyist Magazine 0058 å· ããã¯ãã³ãã¼ Rubyist Magazine 0058 å· RubyKaigi 2018 ç´åç¹éå· Rubyist Magazine 0057 å· RubyKaigi 2017 ç´åç¹éå· Rubyist Magazine 0056 å· Rubyist Magazine 0055 å· Rubyist Magazine 0054 å· æ±äº¬ Ruby ä¼è° 11 ç´
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}