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
goã®gRPCã§ä¾¿å©ãã¼ã«ã使ãã§ç´¹ä»ããã¦ããGo gRPC Middlewareã¨Golang ProtoBuf Validator Compilerã§gRPCã®validationããã¾ãã ä»åã®ä¾ã§ã¯ãUserã®å¹´é½¢ã¯è² æ°ã«ãªããªããé»è©±çªå·ãã¡ã¼ã«ã¢ãã¬ã¹ãæ£è¦è¡¨ç¾ã§validationããã¨ãã£ããã¨ãå®è£ ãã¾ãã ã¤ã³ã¹ãã¼ã« Go gRPC Middlewareã®ã¤ã³ã¹ãã¼ã« ⯠go get github.com/grpc-ecosystem/go-grpc-middleware Golang ProtoBuf Validator Compilerã®ã¤ã³ã¹ãã¼ã« ⯠go get github.com/mwitkow/go-proto-validators/protoc-gen-govalidators ãã¨ã«ãªããµã¼ãã¨ã¯ã©ã¤ã¢ã³ã protobufã§gRPCãå¼ã³åº
Railsã§ã¯ããªãã¼ã·ã§ã³(Validation)ã¨ããä»çµã¿ãããã¾ãã ãã©ã¼ã ãªã©ã§ã¦ã¼ã¶ã¼ããã®å ¥åå¤ãDBã«ä¿åããåã«ãã®å¤ãæ£ãããã®ãã¢ãã«å±¤ã§ï¼ã·ã¹ãã ã¨ãã¦è¨±å¯ãã¦ããå¤ãï¼ãæ¤è¨¼ããä»çµã¿ã§ãã ããªãã¼ã·ã§ã³ã®åºæ¬çãªæµããããªãã¼ã·ã§ã³ã®å®ç¾©ã¨ããªãã¼ã·ã§ã³ã®ãã¹ãæ¹æ³ãããªãã¼ã·ã§ã³ã®ã¹ããããªã©ã®ããªãã¼ã·ã§ã³ã®åºæ¬ã«ã¤ãã¦ã¾ã¨ãã¾ããã åä½ç¢ºèª Rails 4.1 ActiveRecord 4.1 shoulda-matchers 2.6.3 ç®æ¬¡ 1. Railsã§ã®ããªãã¼ã·ã§ã³ã®æµã 2. ããªãã¼ã·ã§ã³ãå®ç¾©ãã 2.1. åå¨ãã§ãã¯(presence) 2.2. ä¸ææ§ï¼ã¦ãã¼ã¯å¶ç´ï¼ã®ãã§ãã¯(uniqueness) 2.3. é·ãã®ãã§ãã¯(length) 2.4. ãã©ã¼ãããã®ãã§ãã¯(format) 2.5. æ°å¤ã®å¤ãã§ãã¯(nu
ãªãã¸ã§ã¯ããDBã«ä¿åãããåã«ããã®ãã¼ã¿ãæ£ãããã©ãããæ¤è¨¼ããä»çµã¿ãããªãã¼ã·ã§ã³ã¨ããã¾ããã Railsã§ActiveRecordã使ã£ã¦ãããå®ç¾ããã«ããã£ã¦ãã使ããããªã®ãã¾ã¨ãã¾ãã 以ä¸ã®ã¡ã½ããã«ããã¦ã¯ããªãã¼ã·ã§ã³ãããªã¬ããã¾ãã create create! save save! update update! 以ä¸ã®ã¡ã½ããã«ããã¦ã¯ããªãã¼ã·ã§ã³ã¯ã¹ãããããã¾ãã decrement! decrement_counter increment! increment_counter toggle! touch update_all update_attribute update_column update_columns update_counters Railsã§ã®ããªãã¼ã·ã§ã³ããªã¬ Railsã§ã¯valid?ã¡ã½ãããå®è¡ããã¨ããªãã¼ã·ã§ã³ãå®
ãã®è¨äºã¯ãAngularJS Advent Calendar 2014 - Adventar ã®19æ¥ç®ã®è¨äºã¨ãªãã¾ããåæ¥ã¯ã@albatrosaryããã®YEOMANã«ããAngularJSé¢é£ã¸ã§ãã¬ã¼ã¿ããç´¹ä»ãã¾ã - albatrosary's blogã§ããYEOMANã®ã¸ã§ãã¬ã¼ã¿ãã使ã£ã¦ããªãã£ãã®ã§ãä»ã®ã触ã£ã¦éããæãã¦ã¿ããã§ãã ä»æ¥ã¯ãAngularJSã®åºæ¬çãªããªãã¼ã·ã§ã³ã®è©±ã§ããAngularJSã®åå¿è åãã®è¨äºã«ãªãã¾ããæè¿ãä»äºã§ãAngularJSã触ãå§ãã¦ããã®ã§ãå°ããã¤ãã¦ãã¦ãå ¬éãã¦ããããã¨æãã¾ãã AngularJSã¯ããªãã¼ã·ã§ã³å¨ãã§ä¾¿å©ãªä»çµã¿ãè²ã ã¨ç¨æããã¦ãã¾ããããããæ¾ãéããã®ããªããªã大å¤ãªãããåºæ¬çãªãã¨ãã¾ã¨ãã¦ã¿ã¾ããã åæ ç°å¢ AngularJS 1.3 ããããã㨠ã¡ã¼ã«ã¢ãã¬ã¹ã
ãRDBã«ãããããªãã¼ã·ã§ã³ããªã¬ã¼ã·ã§ãã«ã¢ãã«ããèãããã¨ããããªãã¨ãæ»ããé¢ç½ã¿ããªãã¿ã¤ãã«ã§ãããã ããRDBã¨Validationã¨ãã2ã¤ãç¸å®¹ããªããã®ã ã¨ãããã¨ãç¥ã£ã¦ãã人ã«ã¯ãå²ã¨ç´ç·ã«è§¦ãã話ããç¥ããªãã æ£ç´ãªã¨ãããç¾å¨ç§ã¯ãã¼ã¿ãã¼ã¹ã¨ã³ã¸ãã¢ä¸ç´ç·ãªã®ã§ãã¢ããªã±ã¼ã·ã§ã³éçºã«ãããã»ãã¥ãªãã£ã¨ããã®ã¯éå¤æ¼¢ã§ããã¨è¨ã£ã¦å·®ãæ¯ããªãããããã¤ãã³ãã«ã¯ãã®å¾³ä¸¸æµ©æ°ï¼ããªããªã®æ¬è·ï¼ãçºè¡¨ãããã¨ããã§ã¯ãªããï¼ï¼é çªçã«ã¯å¾³ä¸¸æ°ã®æ¬¡ã«è©±ããã®ã ãã徳丸æ°ã¯SQLã¤ã³ã¸ã§ã¯ã·ã§ã³ã®å®æ¼ã¾ã§ããã¨ããã¬ãã£ã·ãã§ããã ãå ´ãç½ãããã¦ãã¾ãã®ã§ã¯ãªããã»ã»ã»ã ãã¬ãã®äººããç¹å¤§ã®ããµã«ãªãé£ãã§ããã®ã§ã¯ã»ã»ã»ã ãããªæ³ããè³è£ã«æ±ãã¤ã¤çºè¡¨ã«æãã ã®ã§ãã£ãã ä»åã®æã¡æéã¯20åã¨çãã§ãã£ããããã¾ããããã話ããããã¿ãç¡ãã£ãã®ã§
ãåã¯æ°äººã ããç¥ããªãã¨æããã©ãªã¯ã¨ã¹ããæ¹ç«ããããã¨ããããããã³ãã¨ã³ãValidationã¯å®å ¨ã§ã¯ãªãã
Active Recordã®ããªãã¼ã·ã§ã³ã¨ã³ã¼ã«ããã¯(Active Record Validations and Callbacks) â ãã®ã¬ã¤ãã§ã¯ãActive Record ãªãã¸ã§ã¯ãã®ã©ã¤ããµã¤ã¯ã«ã¸ã®ããã¯ã®æãæ¹ãæãã¾ãã ãã¼ã¿ãã¼ã¹ã«ä¿åãããåã«ãªãã¸ã§ã¯ãã®ç¶æ ãæ¤è¨¼ãããæ¹æ³ã¨ã ã©ã¤ããµã¤ã¯ã«ã®ç¹å®ã®æç¹ã§ã«ã¹ã¿ã æä½ãå®è¡ããæ¹æ³ãå¦ã¹ãã§ãããã ãã®ã¬ã¤ããèªãã§ãæ示ãããæ¦å¿µã試ããå¾ã以ä¸ã®ãã¨ãåºæ¥ãããã«ãªã£ã¦ãããã¨ãæã¿ã¾ãï¼ Active Record ã®ãªãã¸ã§ã¯ãã®ã©ã¤ããµã¤ã¯ã«ã®ç解ã çµã¿è¾¼ã¿ã® Active Record ã®ããªãã¼ã·ã§ã³ãã«ãã®ä½¿ç¨ã ã«ã¹ã¿ã ããªãã¼ã·ã§ã³ã¡ã½ããã®ä½æã ããªãã¼ã·ã§ã³ã®ããã»ã¹ã«ãã£ã¦çæãããã¨ã©ã¼ã¡ãã»ã¼ã¸ã®åä½ã ãªãã¸ã§ã¯ãã®ã©ã¤ããµã¤ã¯ã«å ã®ã¤ãã³ãã«å¿çããã³ã¼ã«
Validationã®ãä½æ³ãã¾ã¨ãã¦ã¿ã¾ãã ããªãã¼ã·ã§ã³ã®åºæ¬çãªãã¿ã¼ã³ã¯åå¨æ§ãé·ãããã©ã¼ããããä¸ææ§ã®ç¢ºèªã¨ãªãã¾ãã æ´çã®ãããããã4ã¤ã®å¦çãRailsã§è¡ãéã®ãä½æ³ãã¾ã¨ãã¦ã¿ã¾ãããã¹ãã³ã¼ããæå¾ã«ä»è¨ãã¦ãã¾ãã åå¨æ§ã®æ¤è¨¼ Userã¨ããnameãemailãæã¤ã¯ã©ã¹ãèãã¦ã¿ã¾ãã ãpresence: trueãã§åå¨æ§ã確èªãããã¨ãã§ãã¾ãã class User < ActiveRecord::Base attr_accessible :name, :email validates :name, presence: true end é·ãã®æ¤è¨¼ åããUserã¯ã©ã¹ã§é·ãã®æ¤è¨¼ãè¡ãã¾ããååãé·ãããã¨å°ãã®ã§50æåã«å¶éããå¦çã«ãã¾ãã length: { maximum: 50 }ãä»ãããã¨ã§æ¤è¨¼ãå¯è½ã§ãã class Use
Rails2.3ã®è©±ã§ãRails3ã§ãåããã¯æªç¢ºèªã§ãã é常ã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ã¯ãã¨ã©ã¼ã«ãªã£ãå±æ§ã®åå + validationåºæã®ã¡ãã»ã¼ã¸ãããããå¤ãããå ´åãlocaleã®ãã¡ã¤ã«ã§"activerecord.errors.full_messages.format"ãä¿®æ£ãããã¨ã§å¤ãããã¨ãåºæ¥ããããã©ã«ã㯠"{{attribute}} {{message}}"ã åå¥ã®validationã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ã ãå¤ãããå ´å ä¾ãã° blank ã®ã¨ã©ã¼ã¡ãã»ã¼ã¸ãå¤ãããå ´å㯠"activerecord.errors.full_messages.blank" ãä¿®æ£ããã å®å ¨ã«åå¥ã§ã¨ã©ã¼ã¡ãã»ã¼ã¸ãå¤ãããå ´å ä¸è¨ã®ããã«"activerecord.errors.full_messages.{messageã§æå®ãããæåå}"ã¨ããã¨ãï½ã # app
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}