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

RUBYʵ¼ù—Êý¾Ý¿â¼òµ¥²Ù×÷

¿ª·¢»·¾³£º
Ruby:1.9.1
Rails:2.3.5
Rake:0.8.7
Rack:1.0.1
Mysql:5.0.9
Ruby-mysql:mysql-2.8.1-x86-mswin
IDE:RubyMine2.0.1
Êý¾Ý¿â×¼±¸£º
database:dbdevelopment
user:crystal
password:crystal
Ò»¡¢´´½¨RubyÏîÄ¿RorTest
¶þ¡¢ÐÞ¸Ädatabase.yml
ÕâÀïÖ»ÆôÓÃdevelopment»·¾³Êý¾Ý¿â£¬ÐÞ¸ÄÅäÖÃÎļþÈçÏ£º
development:
adapter: mysql
encoding: utf8
reconnect: false
database: dbdevelopment
pool: 5
username: crystal
password: crystal
host: localhost
Èý¡¢ÔËÐÐScaffold
RorTest->New->Scaffold  ÔËÐвÎÊý:Product title:string description:string price:integer
³É¹¦ÔËÐк󣬽«ÔÚ¿ØÖÆ̨ÖÐÊä³öÔËÐйý³ÌÖд´½¨µÄĿ¼¼°Îļþ£¨°üÀ¨Model¡¢Help¡¢ViewµÈ£©
ËÄ¡¢·´ÏòÉú³ÉÊý¾Ý¿â±í
ÔÚdb/migrateÏÂÕÒµ½ÀàËÆ create_products.rbÎļþ£¬ÓÒ¼üRun
³É¹¦ÔËÐкó½«ÔÚ¶ÔÓ¦Êý¾Ý¿âÖÐÉú³Éschema_migrations¼°productsÊý¾Ý±í
Îå¡¢ÐÞ¸Äroutes.rb
ÔÚroutes.rbÖÐÌí¼ÓÓ³Éä¹æÔò
map.connect '/products',:controller=>"product",:action=>"index"
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
Áù¡¢Æô¶¯·þÎñÆ÷£¬ÔËÐУ¨http://localhost:3000/products£©
×¢£ºShow¡¢Edit¡¢Destroy¡¢New product¹¦ÄÜ¿ÉÒÔ×Ô¼º²âÊÔһϣ¬ÁíÍâÈç¹ûÔÚmodel/product.rbÖÐÌí¼ÓÈçÏ´úÂ룬¿ÉÒÔ¶ÔproductÖеÄ×ֶνøÐбØÌîÑéÖ¤£¬ÓÐÐËȤµÄÅóÓÑ¿ÉÒÔ²âÊÔÒ»ÏÂ
class Product < ActiveRecord::Base
#ÑéÖ¤±ØÌîÏî
validates_presence_of:title,:price
end
 class Product < ActiveRecord::Base
#ÑéÖ¤±ØÌîÏî,messageΪÏÔʾµÄÄÚÈÝ£¬Ò²¿É²»Ìî ,ÈçÏÂ
#validates_presence_of:title,:price
validates_presence_of:title ,:message=>": Please input title"
validates_presence_of:price, :message=>": Please input price"
end


Ïà¹ØÎĵµ£º

ÓÃrubyдµÄwebץȡС¹¤¾ß

×î½üÓÉÓÚѧϰʹÓÃlinuxϵÄC¿ª·¢£¬ÐèÒª²éѯLinux Cº¯Êý²Î¿¼£¬¾Í¾­³£ÉÏhttp://man.chinaunix.net/develop/c&c++/linux_c/default.htm²é¿´£¬ÃèÊöµÃ±È½ÏÏêϸ¶øÇÒ»¹ÓÐÀý×Ó¡£
ÍøÉÏ»¹ÓÐÐí¶à¸÷ÖÖ¼¼ÊõµÄÍøÒ³¸ñʽµÄ²Î¿¼²ÄÁ϶¼·Ç³£Ç¿´ó£¬¿ÉϧºÜ¶àʱºò¶¼Ã»ÓÐÍø¡£ÓÚÊǾÍÏëд¸ö½Å±¾¿ÉÒÔ°ÑÎĵµÏÂÔØ£¬Ïñandroid¿ª·¢ÕßÎĵµÒ»ÑùŪµ½±¾µØ ......

Ruby ¼ò½é

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

windows ÏÂrubyµÄ°²×°

1£¬°²×°ruby
ÏÂÔصØÖ·£º http://rubyinstaller.org/download.html
2£¬°²×°rails
ʹÓÃÃüÁîÏÂÔØ£ºÔÚÃüÁîÐÐÔËÐÐgem install rails --remote
2£¬³õ²½Á˽ârubyµÄÎÄÕÂ
http://www.bcbbs.net/html/29671.html
http://www.bcbbs.net/dev/List64.aspx ......

Ruby on RailsÖÐselectʹÓ÷½·¨

ÔÚRuby on RailsÖÐÕæµÄÓÐÒ»¶ÑSelect helper¿ÉÒÔÓÃ,ÎÒÃǾ­³£ÈÝÒ×»ìÏý¡£³£¼ûµÄÓÐÈý¸ö..
select, select_tag, collection_select(ÆäÓàµÄʲôselect_dateÄÇЩ²»Ì¸)
ÎÒÃÇÏÈÀ´¿´¿´Ò»¸ö»ù±¾µÄÏÂÀ­Ê½Ñ¡Ïî¹Ç¼Ü
</p>
<select
name="ROR">
<option
value="1">ROR1</option><br
/>
<optio ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ