Aptana Studioã§Rubyã¯ã©ã¹ã®æ§é ã¨å©ç¨ã§ããã¡ã½ããã調ã¹ãæ¹æ³
Aptana Studioã§Rubyã¯ã©ã¹ã®æ§é ã¨å©ç¨ã§ããã¡ã½ããã調ã¹ãæ¹æ³
å
ã®è¨äºã«é¢é£ãã¦ãç§ã¯controllerãªãã¸ã§ã¯ãããã¥ã¼ã§å©ç¨ã§ããå¦ã¾ã§ã¯æ¬ã§èª¿ã¹ããã¨ãã§ããã®ã§ããããã®controllerãªãã¸ã§ã¯ãã§å©ç¨å¯è½ãªã¡ã½ããã«ã¯ã©ããªãã®ãããã®ãã¾ã§ã¯è¦ã¤ãããã
ã¨ãããã¨ã§Aptana Studioã®æ©è½ã®ä¸ã§æ¢ããã¨ã«ãã¾ããã
ããRadRailsãã¼ã¹ãã¯ãã£ãï¼RadRails1.1.1ï¼ã®ç¶æ
ã§ä½æ¥ãã¦ãã¾ãã
ãã«ããéã F1
ç§ã¯é常ã¯VB.NETã§éçºãã¦ã¾ãããå°ã£ãã¨ãã¯F1ãã«ãï¼ã®çãã¤ãã¦ã¾ãã
ä»åãã¾ãã¯layout.rhtmlãéããcontrollerã®è¨è¿°ä½ç½®ã«ã«ã¼ã½ã«ãç«ã¦ã¦F1ãã«ããå®è¡ã
ãã«ãã®ãã¥ã¼ãèµ·åãããªã«ããæ¤ç´¢ãéå§ãã¾ãããâ¦ãé¢é£ãããã¯ãâ¼Aptana ERB ã¨ãã£ã¿ã¼ ã«ã¤ã㦠â¼ãã¤ãããã¯ã»ãã«ã ã¨ããæ
å ±ã¯åºã¦ãã¾ããããã®ä»ä½ãæ
å ±ã¯åºã¦ããªãâ¦ã¡ããã¨è¨è¿°ç®æã¾ã§ã¸ã£ã³ããã¦ããã訳ã§ã¯ãªãããã§ããããã¯é§ç®ã§ããã
宣è¨ãéã F3
次ã«ãä»ã®ã¡ãã¥ã¼ãæ¢ãã¨ãããã²ã¼ãâ宣è¨ãéããã¨ããã¡ãã¥ã¼ãããã¾ãããããã£ã½ãã§ãããã¨ãã訳ã§å®è¡ã
・・・ã¡ãã£ã¨å¦çãéããªã£ãããããï¼ååå®è¡ã®ã¿ï¼ï¼ããã§ããããã®ã¾ã¾åå¿ãªããããªããã¯æ¬¡é
ã§èª¬æãããã¼ã«ããã表示ãåºã¦ãã¾ãããF2ãã¼ãæ¼ããå ´åã¨çµæãåãï¼æ¼ãééãï¼
*1
Show ToolTip F2
ãã¼ã«ããã表示ã¯ãåèªã®é¨åã«ã«ã¼ã½ã«ãåããã¦ãã°ããå¾
ã¤ãF2ãã¼ã§è¡¨ç¤ºããã¾ããèé»è²ã§ãã
以ä¸ã¯ãã®ï¼ä¾ã
ã»ActionView::Base.controller() ã»ActionController::Resources::Resource.controller() ã»ActionController::Caching::Sweeper.controller() ã»ActionController::Pagination::Paginator.controller() ã»ActionController::Integration::Session.controller() ã»ActiveScaffold::DataStructures::ActionLink.controller() ã»ActionController::Resources::Resource.controller() ã»ActionView::Base.controller() ã»ActionController::Caching::Sweeper.controller() ã»ActiveScaffold::DataStructures::ActionLink.controller() ã»BaseLoginProxy.controller() ã»ActionController::Integration::Session.controller() ã»ActionController::Pagination::Paginator.controller() ã»ActionController::Caching::Actions::ActionCachePath.controller()
â¦ãªãã§ãåãè¡ãä¸æ¯åºããã ããã
Aptana Studioãã¡ã¢ãªä¸è¶³ã§ãã¼ã¹ãã¯ãã£ããéãã¦ããã¨è¨ãåºããã®ã§ãAptanaãè½ã¨ãã¦åèµ·åã
â¦ä¸ç¬AptanaStudio.exeãç«ã¡ä¸ããããããã«çµäºãã¦ãã¾ãã
ãããããªãã®ã§PCåèµ·åã
PCã®ã·ã£ãããã¦ã³ä¸ã«javaw.exeãå¼·å¶çµäºããããã¤ã¢ãã°åºã¦ããã®ã§ãJVMãç°å¸¸åæ¢ãã¦ããã§ãããã
AptanaStudioã使ã£ã¦ããã¨è¯ãèµ·ããäºæ
ã§ããï½
ã¡ãªã¿ã«PCã®ã¡ã¢ãªã¯1GBã§ãã
ã¨ãããã¨ã¯PCåèµ·åã¯ä¸è¦ã§javaw.exeãå¼·å¶çµäºãããã°ããã£ãã®ãããããªãã
ãã¦ãPCåèµ·åå¾ã«AptanaStudioãèµ·åãä»åº¦ã¯æ®éã«èµ·åãã¾ããã
ã§ãããä¸åº¦F2ãã¼å®è¡ã
ã»ActionView::Base.controller() ã»ActionController::Resources::Resource.controller() ã»ActionController::Caching::Sweeper.controller() ã»ActionController::Integration::Session.controller() ã»ActionController::Pagination::Paginator.controller() ã»ActiveScaffold::DataStructures::ActionLink.controller()
ä»åº¦ã¯ããããªãã§ãã
ã§ãããã¼ã«ãããå
容ã§ã¯ããã¤ãã®controllerããããããâ¦ãã®å ´åã¯ã©ããæ£è§£ï¼
ãããããªãã®ã§ãã¨ããããç´ ç´ã«ä¸çªä¸ã®ActionView::Base.controllerã®æ
å ±ãæ¢ãã¦ã¿ã¾ãã
é層ã§åãéã Ctrl+Shift+H
ãããã²ã¼ãâé層ã§åãéããã¨ããã¡ãã¥ã¼ãããã¾ããã
ãããå®è¡ã
ããããã¨ãã¤ã¢ãã°ãéããåãå
¥åãã¦ãã ãããã®æ¬ã«ã¯ã©ã¹å®ç¾©ãåå空éä»ã§å
¥åããã¨è©²å½ããã¯ã©ã¹ãçµãè¾¼ãã¾ãã
ããã§ã¯
ActionView::Base
ã¨å®è¡ããã¨ä¸è´ããåãé¸æãããã®ã§ãOKãã¾ãã
ããã¨ãé層ããã¥ã¼ãå¼ã³åºããâ¦ãã®ä¸èº«ã«ã¯ render_* ã¨ãã£ãã¡ã³ãã¼ãã表示ããã¦ã¾ãããâ¦controllerã¯ãªãã
ã©ãã«ãããã ã
ã£ã¨è¡ã£ã¦ãããªãã¨ãªãçç±ã¯å¤ãã¾ãã
Rubyã®ç¹è²ã®ã²ã¨ã¤ãåãã¯ã©ã¹ãå¾ããå¥ãã¡ã¤ã«ã§å®ç¾©ã追å ãã¦ãåä¸ã¯ã©ã¹ã¨ãã¦èªèã§ããæ©è½ã®ãããã§ãããï¼åå失念â¦
Railsã§ã¯ãã®æ©è½ããã³ãã«ãã«æ´»ç¨ãã¦ãã¨åã«ã¯èãã¦ãã¾ããâ¦ãªãã ãç¸å½åæ£ãã¦å®ç¾©ãã¦ããã£ã½ãã§ãã
ã§ãçµå±å®è¡æã«ã¯ActionView::Baseã«ä¸é£ã®ã¡ã³ãã¼ã¨ãã¦æ´çæ¸ã¿ã§ï¼ç®æã§ç´ä»ããããªãã¨ãããªãã¯ãã§ãä»ã¯ãã®æ
å ±ã ã欲ããã®ã ãã©â¦å°ã£ãã
表示ãããµãã¿ã¤ãé層ãã«å¤æ´
ã§ãåããã¥ã¼çªã®å³ä¸ã«â½ãã¼ã¯ããã£ã¦ããããã表示å¤æ´ã®ãªãã·ã§ã³ãå®è¡å¯è½ã§ããã
ãã®ä¸ã§ãä»ã¯ãåé層ã表示ã ã£ãã®ãããµãã¿ã¤ãé層ãã«å¤æ´ããã¨â¦ããããªãã¨ãªãActionView::Baseã¨ãã¦æ´çæ¸ã¿ã«ãããä¸é£ã®ã¡ã³ãã¼ãå
¨ã¦åºã¦ããã£ã½ãã
ããã¦è¦ã¤ãã¾ãããcontroller()ã
ã§ãããããããï¼ï¼ï¼
è¦ã¤ããcontroller()ãé¸æããã¾ãã¯ãéãããå®è¡ã
ããããã¨base.rbã¨ããè¨è¿°ç®æã«ã¸ã£ã³ããã¾ããã
class Base include ERB::Util attr_reader :first_render attr_accessor :base_path, :assigns, :template_extension attr_accessor :controller
Baseã¯ã©ã¹ã®ã¢ã¯ã»ãµã¡ã½ããã®ããã§ããã
ã§ãããã®controllerã®åå¾å
ãæ´ã«è¾¿ãã¨â¦
def initialize(base_path = nil, assigns_for_first_render = {}, controller = nil)#:nodoc: @base_path, @assigns = base_path, assigns_for_first_render @assigns_added = nil @controller = controller @logger = controller && controller.logger end
ãï¼ãã¼ãã§ãã¯ã§ã³ã³ã¹ãã©ã¯ã¿ã®å¼æ°ããç´æ¥æ¸¡ããã¦ããï¼
ã£ã¦ãã¨ã¯ActionBase::Viewã¨ãã¦ã¯controllerã®åã¯ãã®æç¹ã§æèãã¦ããªãâ¦ã£ã¦ãã¨ï¼
ã¨ãããã¨ã¯ãããã¾ã§æ¥ã¦ãã£ã±ãcontrollerãä½ã®ãªãã¸ã§ã¯ããªã®ãã¯ã誰ãã«æããããå
¨é¨ã®å¼ã³åºãå
ããã§ãã¯ãã¦ã¾ãããããªãã¨ãããã¨ï¼
*2
ããã§ã®ãã¢ãããã¾ããcontrollerã ããã ãããActionControllerã®å±æ§ãå¼ã£å¼µãããã ã¨æããã§ããã©ãã
ç解ãã£ã¦ããã§ãããããã ããã¢ããã¤ã¹ã欲ããã
ã§ãç解ããã£ã¦ãã®ãªãããªãã»ã©ãããRailsæåãVB.NETãJavaã¨ã¯ãã£ã±ãéããã ãªãã
*1:æµç³ã¯å®è¡æã«åçã«å¤æ°ã®åã決ã¾ãRubyãã ãããã®å ´åã§ãå¼ã³åºãåè£ã«ãªããããªå®ç¾©ãããã£ãããªã¹ãã¢ãããã¦ããï¼åç´ãªãã¹ã®æååæ¤ç´¢ï¼
*2:ä¸å¿ãã®ãã¨ãcontrollerãããå¼ã³åºãé層ãéãããå®è¡ãã¦å¼ã³åºãå ãããä½ç½®ãç·ãããã§ããªããã¨ããªãããã ã£ããã§ãã
*3:ãããªGUIã®ãã¥ã¼ã¨ãã«é ¼ããªãã¦ãscript/consoleã§ã³ãã³ãå©ãã¦èª¿ã¹ããã¨ããæè¦ãããã¨æãã¾ãã;;;ä»åã¯Aptanaã§ãã©ã¤ãã¦ã¿ã¾ããã®ã§ã容赦ãï½