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

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: test
username: root
password: root
host: localhost
3¡¢´´½¨Controller
ÔÚapp/controllerÖд´½¨say_controller.rb
´´½¨Íê³Éºó£¬ÔÚ¿ØÖÆÌ¨ÐÅÏ¢Öн«ÏÔʾ´Ë¹ý³Ì´´½¨µÄһϵÁÐÎļþ
C:\Ruby19\bin\ruby.exe -e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift) E:/Ruby/HelloWorld/script/generate controller -s say
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/say
      exists  test/functional/
      create  test/unit/helpers/
      create  app/controllers/say_controller.rb
      create  test/functional/say_controller_test.rb
      create  app/helpers/say_helper.rb
      create  test/unit/helpers/say_helper_test.rb
Process finished with exit code 0
4¡¢ÐÞ¸Äsay_controller.rb
½«ÄÚÈÝÐÞ¸ÄÈçÏ£º
class SayController < ApplicationController
def hello
end
end
5¡¢´´½¨hello.rhtml.erb
ÔÚapp/views/say Ŀ¼Ï´´½¨hello.rhtml.erb
ÐÞ¸ÄÆäÖеÄÄÚÈÝÈçÏ£º
<html>
<head>
<title>Hello, Rails!</title>
</head>
<body>
<h1>Hello from Rails!</h1>
</body>
</html>
6¡¢ÐÞ¸Äroutes.rb
ÐÞ¸Äconfig/routes.rb£¬ÉèÖÃеÄÓ³É乿Ôò
#·ÓÉÉèÖã¬/say/HelloÊǵØÖ·ÉèÖã»controllerÊǶÔÓ¦µÄcontrollersĿ¼ÏµÄÀ࣬actionÖ¸controllerÖж¨ÒåµÄ·½·¨£¬Çø±ð´óСд
map.connect '/say/Hello',:controller=>"say",:action=>"hello"
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
Æô¶¯·þÎñRails·þÎñÆ


Ïà¹ØÎĵµ£º

Install Cassandra with Ruby 1.9.1 on Windows

To get it done is not easy. I spent a whole day to figure out the various compatibility issues along the way out.
Now there still might be potential issues, but it works by my rough test.
Step 1: Install Apache Cassandra
  You may know that the Ruby gem cassandra will do it for you.
  ......

ruby Á¬½Ó²Ù×÷ sql2005


The following is improved version of the code created by David Mullet, from
http://rubyonwindows.blogspot.com/2007/03/ruby-ado-and-sqlserver.html
require 'win32ole'
class SqlServer
# This class manages database connection and queries
attr_accessor :connection, :data, :fields
attr_wr ......

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

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

Ruby ³ÌÐòÔ±µÄÖ¿ÓÑ

ÀúÊ·±³¾°£Û1£Ý
µ®ÉúÓÚ1993Äê2ÔÂ24ÈÕµÄRuby(ºì±¦Ê¯)£¬ÓÉÈÕ±¾ÈËËɱ¾Ðк루Yuki Matsumoto£©ÓÚ1994Äê12Ô·¢²¼¡£ Ruby ×÷ΪһÖÖ´¿ÃæÏò¶ÔÏóµÄ½Å±¾³ÌÐòÉè¼ÆÓïÑÔ£¬ÎüÊÕÁËSmalltalkºÍPerlÁ½ÖÖ³ÌÐòÓïÑÔµÄÌØÐÔ¡£
RubyÀíÄî£Û2£Ý
1.Ê×ÏÈ¿¼ÂǵÄÊÇ£¬¼õÉÙ±à³Ìʱ²»±ØÒªµÄËöËéʱ¼ä£¬Áî±àд³ÌÐòµÄÈ˸ßÐË£»
2.Æä´ÎÊÇÁ¼ºÃµÄ½çÃæÉè¼Æ£»
3.Ç¿ ......

Ruby ¼ò½é

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