Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Ruby formµÄÁ½ÖÖд·¨

ÏÂÃæ½éÉÜRuby formµÄÁ½ÖÖд·¨¡£
Ruby formд·¨Ò»£ºÊ¹ÓÃform_for
< % form_for :order, :url => { :action => :save_order } do |form| %>   < p>    < %= label :order, :name, "Name:" %>    < %= form.text_field :name, :size => 40 %>     < /p>   < p>    < %= label :order, :address, "Address:" %>    < %= form.text_area :address, :rows => 3, :cols => 40 %>   < /p>   < p>    < %= label :order, :email, "E-Mail:" %>    < %= form.text_field :email, :size => 40 %>   < /p>   < %= submit_tag "Place Order" , :class => "submit" %> < % end %> 
À´¿´¿´½âÊÍ
ÒýÓÃ
There are two interesting things in this code. First, the form_for helper on line 1 sets up a standard HTML form. But it does more. The first parameter, : order,tells the method that it’s dealing with an object in an instance variable named @order. The helper uses this information when naming fields and when arranging for the field values to be passed back to the controller.
The :url parameter tells the helper what to do when the user hits the submit button. In this case, we’ll generate an HTTP POST request that’ll end up getting handled by the save_order action in the controller.
¶øÃ¿¸öformµÄhelper·½·¨£¬Èçform.text_area,form_text_field,ºóÃæ¸úµÄ·ûºÅ£¬Èç:name,:address,:email£¬µÈ¶¼ÊÇÕâ¸ömodelµÄÊôÐÔ¡£form_f


Ïà¹ØÎĵµ£º

RubyÉùÒô


ת Adding Sound to Your Ruby Apps
Have you ever thought about including sounds in your Ruby application? Used sparingly, sound may enhance your applications by adding audio cues or a custom touch. You could, for example, play a beep or chime that announces the completion of a lengthy process. Per ......

Ñ¡Ruby»¹ÊÇÑ¡Python

 
  ¡¡×î½ü£¬ÎÒÐèÒªÒ»ÖÖ¿ìËÙ¿ª·¢ÓïÑÔ£¬Ä¿Ç°ÖËÊÖ¿ÉÈȵĿìËÙ¿ª·¢ÓïÑÔ¾ÍÊÇPythonºÍRubyÁË¡£RubyºÍPython¶¼ÊǷdz£ÓÅÐãµÄ½Å±¾ÓïÑÔ£¬ËäÈ»ËûÃǵÄÉè¼ÆÕÜѧ¼¸ºõÍêÈ«²»Í¬£¬µ«ËûÃÇЧÂʲ¶à£¬Ó¦ÓÃÁìÓòÒ²²î¾à²»´ó£¬ËƺõÌìÉú¾ÍÊǾºÕù¶ÔÊÖ¡£µ½µ×Ñ¡ÄǸöÄØ?ÎÒ×öÁËһЩ¼òµ¥µÄ±È½Ï¡£  
   
  ¡¡¡¡ÎÒÃDZȽ ......

Windowsƽ̨µÄruby IDE µãÆÀ

ת×Ô http://www.javaeye.com/topic/57474 
Windowsƽ̨µÄruby IDE µãÆÀ
ÔÚMacOSƽ̨¼¸ºõûÓÐʲôÕùÒéÐÔ£¬´ó¼Ò¶¼ÓÃTextMate¡£µ«ÊÇWindowsƽ̨¿É¹©Ñ¡ÔñºÍʹÓõÄIDEºÜ¶à£¬È´¸÷Óи÷µÄ³¤´¦ºÍ¶Ì´¦¡£»ùÓÚÎÒÓùýµÄËùÓÐruby IDEµãÆÀһϡ£windowsƽ̨µÄRoR IDEÖ÷Òª·ÖΪÁ½ÀࣺһÀàÊÇÖØÁ¿¼¶µÄÈ«¹¦ÄÜIDE£¬ÀýÈçEclipse£¬Netbeans ......

Ruby on Rails ÃüÁî²Î¿¼

1.1.Rails
1.1 ´´½¨Ò»¸öRailsÓ¦ÓóÌÐò
$ rails app_name
¿ÉÑ¡Ïî:
-d, database=xxx Ö¸¶¨°²×°Ò»¸öÊý¾Ý¿â(mysql oracle postgresql sqlite2 sqlite3 ), ĬÈÏÇé¿öÏÂÊÇÊý¾Ý¿â
-r, ruby-path= Ö¸¶¨RubyµÄ°²×°Â·¾¶,Èç¹ûûÓÐÖ¸¶¨£¬scriptsʹÓÃenvÈ¥ÕÒRuby
-f, freeze (¶³½á)freezes RailsÔÚvendor/railsĿ¼
1.2 API Docume ......

Rubyʵ¼ù—HelloWorld

¿ª·¢»·¾³
OS£ºWindowsXP
Ruby: Ruby1.9.1
Rails: Rails2.3.5
IDE: RubyMine2.0.1
1¡¢´´½¨Rails¹¤³Ì
2¡¢ÐÞ¸Ä /config/database.yml
×Ô¶¯´´½¨µÄ¹¤³ÌÖÐĬÈÏÊý¾Ý¿âÁ¬½ÓµÄÊÇsqlite£¬Èç¹ûûÓа²×°´ËÊý¾Ý¿â£¬ÐèÒªÐ޸ĸÃÅäÖ㨱¾ÀýÖÐʹÓõÄÊÇmysql£©
# Mysql Version 5.1.46
development:
adapter: mysql
database: ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ