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

×îÏêϸµÄRuby on Rails°²×°²½Öè


±¾ÎĽéÉÜÁËRuby on RailsµÄÏêϸ°²×°²½Öè¡£ÎÄÖÐʹÓõÄRuby on Rails°æ±¾ÊÇ1.8.6-26¡£°²×°RubyÖ®ºó°²×°Rails£¬È»ºó¾Í¿ÉÒÔ´´½¨WebÓ¦Ó㬲¢ÔÚ±¾µØ²âÊÔÁË¡£
1¡¢°²×°ruby
²»ÓÃ˵ ÊÇÏÂÔØ°²×°°ü£ºhttp://rubyforge.org/frs/?group_id=167£¬×¢Òâ°æ±¾---º¦È˲»Ç³£¬ºóÃæ»á˵µ½£¬ÎÒϵÄÊÇ1.8.6-26
×°Íêºó£¬¿ÉÒÔÓÃruby -v ²âÊÔÊÇ·ñ°²×°³É¹¦£¬Èçͼ£¬ÒªÊdzöÏÖÁË°æ±¾ ¾Í˵Ã÷°²×°³É¹¦ÁË
 
2¡¢ruby°²×°Íê³Éºó£¬°²×°rails
ÔÚÃüÁîÐÐÏÂÔËÐÐ gem install rails£¬»áÓÐËÄÎå¸öÌáʾ һ·Y£¬°²×°Íêºó£¬ÒÀ¾É¿ÉÒÔÓÃrails -v£¬ À´¼ì²ârails ÊÇ·ñ°²×°³É¹¦
 
3¡¢´´½¨WebÓ¦ÓÃ
»¹ÊÇÃüÁîÐÐÏÂÊäÈë rails testweb£¬±ÈÈ統ǰµÄ·¾¶ÊÇ C:\Documents and Settings\Administrator>rails testweb£¬±ã»áÔÚC:\Documents and Settings\AdministratorÏ´´½¨Ò»¸ötestwebÎļþ¼Ð¡£
 
 
PS£ºÕâÀïÊÇ¿ÉÒÔ¼Ó·¾¶µÄ ±ÈÈç rails C://test£¬¾ßÌå¿ÉÒÔ¿´¹Ù·½API:http://api.rubyonrails.org/
4¡¢ÔÚµ±Ç°Ä¿Â¼£¨testweb£©Ï£¬ÔËÐÐ ruby script\server Æô¶¯·þÎñ£¬¹ØÓÚwebrick·þÎñÆ÷¸ü¶àµÄÐÅÏ¢¿ÉÒÔ·ÃÎÊ http://www.webrick.org/
 
5¡¢ä¯ÀÀÆ÷ÖÐÊäÈëhttp://localhost:3000/£¬Èç¹û¿´µ½ÒÔÏÂÒ³Ã棬˵Ã÷OK
 
6¡¢Ð´Ò»¸öHelloWorldµÄWeb³ÌÐò£¬ruby script\generate controller HelloWorldÃüÁî
 
È»ºóÕÒµ½hello_world_controller.rb
 
ÊäÈëÒÔÏ´úÂ룬±£´æ
class HelloWorldController < ApplicationController    def index         render:text=>"hello world"   end    end 
ÎÒÔø¾­Óà render_text "Hello RoR World"   ÊÔÁË°ëÌìÒ²²»¹ÜÓã¬ËÑÁË°ëÌì²Å·¢ÏÖÊÇ°æ±¾µÄÎÊÌ⣬¾­Ñé°¡
ÔÚä¯ÀÀÆ÷Öдò¿ªhttp://localhost:3000/hello_world£¬¾Í»á¿´¼û½á¹û
 
PS:³õѧµÄÒ»µãµã¼Ç¼£¬»¹Ï£Íûrails¸ßÊÖÄÜÖ¸µãÒ»¶þ.
1¡¢»òÐíÓеÄÅóÓѸúÎÒÒ»Ñù ¿´²»µ½hello world£¬²é¿´ÈÕÖ¾£¬³öÏÖÈçÏ´íÎó
Status: 500 Internal Server Error
no such file to load -- sqlite3
ÕâÊÇÓÉÓÚûÓÐ×°sqlite3Êý¾Ý¿â£¬http://files.cnblogs.com/geek007/sqlite3.rar ÕâÀïÏÂÔØ£¬
È»ºó½âѹµ½rubyµÄbinĿ¼£ºD:\ruby\bin£¬ÃüÁîÐÐÖ´ÐУºgem install "D:\ruby\bin\sqlite3-ruby-1.2.3-mswin32.gem"


Ïà¹ØÎĵµ£º

Ò»²½Ò»²½Ñ§Ruby(Ê®¶þ):RubyÀà

Ò»¡¢ÀàµÄ¶¨Òå¡¢ÀàµÄʵÀý·½·¨ ¶þ¡¢Ìض¨¶ÔÏóµÄ·½·¨ ÔÚRubyÀÎÒÃÇ¿ÉÒÔΪһ¸ö¶ÔÏ󵥶À¶¨Òå·½·¨ Èý¡¢Öض¨Òå·½·¨ ´ÓÏÂÃæ´úÂë¿ÉÒÔ¿´³ö£¬ºóÃæµÄ¶¨Òå»á¸²¸ÇÇ°ÃæµÄ¶¨Òå ËÄ¡¢ÖØдò¿ªÀà RubyÀïÎÒÃÇ¿ÉÒÔÔÙ´ò¿ªÒ»¸öÀ࣬ÏòÕâÀàÌí¼Ó·½·¨£¬ÓеãÏñC#ÀïµÄ·Ö²¿À࣬µ«²»ÓüÓÌرð±ê¼Ç. ÎÒÃÇÒ»°ã²»Òª²ð¿ªÀàµÄ¶¨Ò壬ÒòΪÄÇÑù²»ºÃÀí½ ......

¸øjsµÄÊý×éʵÏÖÒ»¸öÀàËÆrubyµÄµü´úÆ÷


·ÖΪÈçϼ¸½Ú:
·»ù±¾ÊµÏÖ
·ÔÚµü´úÖÐÒýÓÃÔ­À´µÄ¶ÔÏ󣬻òÕßÖ±½Ó¸Ä±äÊý×éµÄÖµ¶ø²»ÊÇ·µ»ØÒ»¸öÐÂÊý×é
·Ïòµü´ú´«ÈëÎÞÏÞ¶àµÄ²ÎÊý
·»ù±¾ÊµÏÖ
½ñÌìͻȻ·¢ÏÖjsµÄÊý×é´¦ÀíÆðÀ´ÕæÊÇÂé·³,´úÂëһЩ¾ÍÊÇÒ»´ó¶Ñ,Ïà±ÈÆðrubyµÄµü´úÆ÷À´ÕæÊÇÑ·É«²»ÉÙ,Ö÷ÒªÊÇҪдµÄ´úÂëÌ«¶àÁË,Ò²ÐíÊÇjsÓÐÌØÊâµÄ´¦ÀíÊý×éµÄ·½Ê ......

ruby ÖÐʹÓà Dom¼¼ÊõÀ´²éÕÒÒ³ÃæÔªËØ


ÓÐЩʱºò¿ÉÄÜ»á¸ù¾ÝһЩÓÐÏÞµÄÐÅÏ¢£¬À´²éÕÒÒ³ÃæµÄÔªËØ£¬ÕâÀï¾ÙÒ»¸öÀý×ÓÀûÓÃÒ³ÃæÎÄ×ÖÀ´²éÕÒËùÔڵıêÇ©£¬ÒÔÌÔ±¦µÄµÇ¼ҳÃæΪÀý£¬Ê¹ÓÃÒÔÏ´úÂë¿ÉÒÔʵÏÖ¸ù¾ÝÕË»§ÃûÀ´Ê¶±ð¶ÔÓ¦µÄ½ÚµãÃû³Æ£º 
require ‘watir’
#ie = Watir::IE.attach(:url, /member1.taobao.com/)
ie = Watir::IE.start(”http://memb ......

rubyÎļþ²Ù×÷

1¡¢ÎļþµÄ´ò¿ªÓë¹Ø±Õ
    ``r'' Read-only, starts at beginning of file (default mode).
    ``r+'' Read-write, starts at beginning of file.
    ``w'' Write-only, truncates existing file to zero length or creates a new file for writing. ......

Óà Ruby ²È²ÈËÄÈË°ï




ÉÏÉÏÖÜÔÚÊéµê¿´µ½Ò»±¾¡¶Ruby
Éè¼Æģʽ¡·£¬¼ñÆðÀ´ 10 ·ÖÖÓ¿´Í꣬ÈÓÁË£¨±ðÎÊÎÒΪʲô……£©
ÏÂÃæÓÃ Ruby
ддÉè¼Æģʽ£¬Ë³±ãÅúÒ»Åú Java ºÍ Gof
¡£
1.Factory
ºÍ Abstract Factory
class
 Factory  
  attr_accessor :product
   ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ