Railsã¯ä¾¿åˆ©ã ã¨ã¯æ€ã£ãŸãŒãƒ•ãƒ¬ãƒ¼ãƒ ワークã¨ã—ã¦ã¨ãã«å¥½ãã§ã¯ãªã‹ã£ãŸï¼ˆåˆ¥ã«å«Œã„ã§ã‚‚ãªã„)。ãã‚Œã«å¯¾ã—ã¦Sinatraã¯ãªã‚“ã ã‹ã‚ˆãã§ãã¦ã‚‹æ„ŸãŒã‚ã£ã¦æ°—ã«å…¥ã£ã¦ã„る。ã“ã®å·®ãŒã©ã“ã‹ã‚‰ãã‚‹ã®ã‹ã¯ã‚ˆãã‚ã‹ã‚‰ãªã„ãŒã€‚ ãã‚“ãªSinatraã¨Railsã§ã‚ã‚‹ãŒã€æ¯”較ã—ã¦ã¿ã‚‹ã¨ã€ãƒ•ã‚£ãƒ«ã‚¿ã¾ã‚ã‚Šã¯åœ§å€’çš„ã«Railsã®æ–¹ãŒé«˜æ©Ÿèƒ½ã§ã‚る。Sinatraã®ãƒ•ã‚£ãƒ«ã‚¿ã¯beforeã¨ã„ã†ä¸€ç¨®é¡žã§ã€ã—ã‹ã‚‚共通処ç†ã‚’書ã‘ã‚‹ã ã‘ã§ã‚る。ã“ã‚“ãªæ„Ÿã˜ã€‚ before do if not logged_in? redirect '/' end endRailsã¨æ¯”ã¹ã‚‹ã¨ 呼ã¶ã‚¿ã‚¤ãƒŸãƒ³ã‚°ãŒbeforeã—ã‹ãªã„。Railsã ã¨before_filter, after_filter, around_filterã®3種類ã®ãƒ•ã‚£ãƒ«ã‚¿ãŒã‚る。 ã©ã®ãƒ¡ã‚½ãƒƒãƒ‰ã«å¯¾ã—ã¦ãƒ•ã‚£ãƒ«ã‚¿å‡¦ç†ã‚’è¡Œã†ã‹ã‚’制御ã§ããªã„。Railsã¯before_filt
{{#tags}}- {{label}}
{{/tags}}