Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 ¼ò½é

    Ruby£¬Ò»ÖÖ為簡單¿ì½ÝÎï¼þ導Ïò編³Ì£¨ÃæÏò¶ÔÏó³ÌÐòÉè¼Æ£©¶ø創µÄ½Å±¾語ÑÔ£¬ÔÚ20ÊÀ¼Í90Äê´úÓÉÈÕ±¾ÈËËɱ¾Ðк루¤Þ¤Ä¤â¤È¤æ¤­¤Ò¤í£¯Yukihiro Matsumoto£©¿ª·¢£¬×ñÊØGPLЭÒéºÍRuby License¡£ËüµÄÁé¸ÐÓëÌØÐÔÀ´×ÔÓÚPerl¡¢Smalltalk¡¢Eiffel¡¢Ada ÒÔ¼° Lisp ......

rubyµ÷ÓÃÆ½Ì¨Ö¸Áîɾ³ýÖ¸¶¨Îļþ¼Ð

Õý³£Çé¿öÏ£¬rubyÈç¹û·¢ÏÖÎļþ¼ÐÖÐÓÐsystem£¬readonly£¬hideÀàÐ͵ÄÎļþ£¬ÔòÊDz»ÄÜÖ±½Óɾ³ý
ËûÃǵġ£ÈçºÎ½â¾öÄØ£¿
ÒÔÆäÈËÖ®µÀ»¹ÖÎÆäÈËÖ®Éí£¡
def dryf(fpath) #destroy file
x = Iconv.iconv('utf-8','gbk',fpath).to_s
%x{attrib -R -S -H \"#{Iconv.iconv('gbk','utf-8',x).to_s}\"}
f = File.new(f ......

Rubyʵ¼ù—Á¬½ÓMysql

°²×°»·¾³£º
OS£ºWindows XP
Ruby: Ruby1.9.1
Mysql: Mysql5.1.46 £¨username/password: root/root  port:3306£©
Ruby-Mysql Driver: mysql-2.8.1-x86-mswin32.gem
£¨×¢£ºÓÃ2.7.3°æ±¾µÄÇý¶¯ÔÚ²âÊÔʱ»á³öÏÖ require"mysql"£¬ÕÒ²»µ½Ö¸¶¨Ä£¿é ´íÎó£©
IDE£ºRubyMine2.0.1
°²×°Ruby,RubyMine,MysqlµÄÊÂÏîÔÚÕâÀï¾Í²»¶à ......

netbeans + ruby + watir web×Ô¶¯²âÊÔ¿ò¼Ü´î½¨

ÕâÊÇÒ»¸ö¿ªÔ´£¬Ãâ·Ñ£¬ÁéÇÉ£¬¼òÒ×µÄweb×Ô¶¯»¯²âÊÔ×éºÏ¿ò¼Ü£»Í¨³£Çé¿ö£¬¿ªÔ´µÄ¶«Î÷×ÜÊǸøÈËÒÔÃÔÈË£¬¿ª·ÅʽµÄ´¥¸Ð£¬µ«Í¬Ê±£¬Ò²ÈÃÈËÄÑÒÔ¿ìËÙ½Ó½ü£¨ÏñÊǶ«·½ÄÐÈË¿´´ýÎ÷·½ÃÀÅ®£©£»ÒªÁ˽âÒ»¸ö¿ªÔ´¶øÇÒ×éºÏƯÁÁµÄ¿ò¼Ü£¬×ÜÊÇÒª·ÑЩÖÜÕÂ......×ܶøÑÔÖ®£¬Ëü²»»áÏñÊշѵĶ«Î÷£¬ÄãºÜÌÖÑáËü£¬µ«²»¿É·ñÈÏ£¬ÄãµÄ¸¶·ÑÆäʵ»»È¡Á˱ðÈ˵ÄËöËéÀͶ ......

Rubyʵ¼ù—will_paginateʵÏÖ·ÖÒ³

¿ª·¢»·¾³£º
OS:Windows XP
Ruby:Ruby1.9.1
Rails:Rails2.3.5
will_paginate:will_paginate2.3.11
(ÔÚÃüÁîÐÐÖÐÔËÐÐ gem install mislav-will_paginate --source http://gems.github.com )
IDE:Rubymine2.0.1
DB:mysql5.0.9
±¾ÀýÔÚÉÏÒ»¸öÀý×Ó£¨Rubyʵ¼ù—¼òµ¥Êý¾Ý¿â²Ù×÷£©µÄ»ù´¡ÉÏʵÏÖ·ÖÒ³£¬ÀûÓõÄÊÇwill_p ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ