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 Documentation
$ gem_server
Æô¶¯Ò»¸öWEBrick·þÎñÆ÷¡£ÕâʱºòÄã¿ÉÒÔͨ¹ýHttp://localhost:8808/ ´ò¿ªä¯ÀÀÆ÷È¥²é¿´rails APIÎĵµ
1.3 Rake
rake db:fixtures:load
# ÔØÈëfixturesµ½µ±Ç°»·¾³µÄÊý¾Ý¿â
# ÔØÈëÖ¸¶¨µÄfixturesʹÓÃFIXTURES=x,y
rake db:migrate
# Ç¨ÒÆÊý¾Ý¿âͨ¹ýÔÚdb/migrateĿ¼ÏµĽű¾.¿ÉÒÔÖ¸¶¨°æ±¾ºÅͨ¹ýVERSION=x
rake db:schema:dump
# ´´½¨Ò»¸ödb/schema.rbÎļþ£¬Í¨¹ýARÄܹý¹»Ö§³ÖÈκÎÊý¾Ý¿âȥʹÓÃ
rake db:schema:load
# ÔÙÈëÒ»¸öschema.rbÎļþ½øÊý¾Ý¿â
rake db:sessions:clear
# Çå¿Õsessions±í
rake db:sessions:create
# ÓÃCGI::Session::ActiveRecordStore´´½¨Ò»¸ösessions±íΪÓû§
rake db:structure:dump
# µ¼³öÊý¾Ý¿â½á¹¹ÎªÒ»¸öSQLÎļþ
rake db:test:clone
# ÖØÐ´´½¨Ò»¸ö²âÊÔÊý¾Ý¿â´Óµ±Ç°»·¾³Êý¾Ý¿âÖÐ
rake db:test:clone_structure
# ÖØÐ´´½¨²âÊÔÊý¾Ý¿â´Ó¿ª·¢Ä£Ê½Êý¾Ý¿â
rake db:testrepare
# ×¼±¸²âÊÔÊý¾Ý¿â²¢ÔÚÈëschema
rake db:testurge
# Çå¿Õ²âÊÔÊý¾Ý¿â
rake doc:app
# ´´½¨HTMLÎļþµÄAPI Documentation
rake doc:clobber_app
# ɾ³ýDocumentation
rake doc:clobber_plugins
# ɾ³ý plugin Documentation
rake doc:clobber_rails
# ɾ³ýDocumentation
rake doclugins
# ²úÉúDocumationΪËùÓа²×°µÄplugins
rake doc:rails
# ´´½¨HTMLÎļþµÄAPI Documentation
rake doc:reapp
# Ç¿ÖÆÖØÐ´´½¨HTMLÎļþµÄAPI Documentation
rake doc:rerails
# Ç¿ÖÆÖØÐ´´½¨HTMLÎļþµÄAPI Documentation
rake log:clear
# Çå¿ÕĿ¼log/ϵÄËùÓÐÈÕÖ¾Îļþ
rake rails:freeze:edge
# Lock this application to latest Edge Rails. Lock a specific revision with REVISION=X
rake rails:freeze:gems
# Lock this application to the current gems (by unpacking them into vendor/rails)
rake rails:unfreeze
# Unlock this application from freeze of gems or edge and return to a fluid use of system gems
rake rails:update
# Update both scripts and public/ja
Ïà¹ØÎĵµ£º
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 ......
rubygems
Ruby on Rails ÊÇÒ»¸ö¿ÉÒÔʹÄ㿪·¢£¬²¿Êð£¬Î¬»¤ web Ó¦ÓóÌÐò±äµÃ¼òµ¥µÄ¿ò¼Ü¡£
¡¡¡¡RubyµÄ×÷ÕßÓÚ1993Äê2ÔÂ24ÈÕ¿ªÊ¼±àдRuby£¬Ö±ÖÁ1995Äê12Ô²ÅÕýʽ¹«¿ª·¢²¼ÓÚfj£¨ÐÂÎÅ×飩¡£Ö®ËùÒÔ³ÆÎªRuby£¬ÊÇÒòΪPerlµÄ·¢ÒôÓë6Ôµĵ®Éúʯpearl£¨ÕäÖ飩Ïàͬ£¬Òò´ËRubyÒÔ7Ôµĵ®Éúʯruby£¨ºì±¦Ê¯£©ÃüÃû¡£railsÔÚÓ¢ÎÄÖÐÊÇÀ¸¸ËµÄ ......
b = "123"
a = b
b.gsub!(/2/,"")
puts a
µÃµ½µÄ½á¹ûÊÇ13£¬·¢ÏÖÈç¹ûa = bµÄ»°Ã²ËÆÖ»ÊǰÑbµÄÖ¸Õë¸øÁËa£¬µ«ÊÇÈç¹ûbµÄÖµ·¢ÉúÁ˱仯a²ÅÄÜ´ÓbÖжÀÁ¢³öÀ´¡£
Èç¹û°ÑÉÏÃæµÄ´úÂë¸Ä³É
b = "123"
a = "#{b}"
b.gsub!(/2/,"")
puts a
ÔòµÃµ½µÄ½á¹ûΪ123£¬ÕâÀïÊǰÑbµÄÖµ¸øÁ ......
ÔÚRuby on RailsÖÐÕæµÄÓÐÒ»¶ÑSelect helper¿ÉÒÔÓÃ,ÎÒÃǾ³£ÈÝÒ×»ìÏý¡£³£¼ûµÄÓÐÈý¸ö..
select, select_tag, collection_select(ÆäÓàµÄʲôselect_dateÄÇЩ²»Ì¸)
ÎÒÃÇÏÈÀ´¿´¿´Ò»¸ö»ù±¾µÄÏÂÀʽѡÏî¹Ç¼Ü
</p>
<select
name="ROR">
<option
value="1">ROR1</option><br
/>
<optio ......