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

ruby on rails(Ê®) ¶©µ¥´¦ÖÃ

¶©µ¥´¦Öã¬Ê×ÏÈÒªÓÐÒ»¸ö¶©µ¥µÄÏêϸÁÐ±í£¨°üÀ¨ÊýÁ¿£¬¼ÛǮɶµÄ£©ºÍÒ»¸ö¶ÔÓÚ¸öÈ˵ÄһЩÐÅÏ¢µÄÒ»¸ö±í¡£Òò¶øÎÒÃÇ´´ÔìÁ½¸öÄ£ÐÍ£¬line_item(ÁбíÏî),order(Áбí)£¬Æäºó±àÕßÈç´Î
/db/migrate xxx_create_order xxx_line_item
Ruby´úÂë
Ò».class CreateOrders < ActiveRecord::Migration
¶þ.def self.up
3. create_table :orders do |t|
4. t.string :name
5. t.text :address
6. t.string :email
7. t.string :pay_type, :limit => Ê®
8. t.timestamps
9. end
Ê®.end
11.
12.def self.down
13. drop_table :orders
14.end
15.d
class CreateOrders < ActiveRecord::Migration
def self.up
create_table :orders do |t|
t.string :name
t.text :address
t.string :email
t.string :pay_type, :limit => Ê®
t.timestamps
end
end
def self.down
drop_table :orders
end
end
Ruby´úÂë
1. class CreateLineItems < ActiveRecord::Migration
¶þ.def self.up
3. create_table :line_items do |t|
4. t.integer :product_id, :null => false,:options =>
5. "CONSTRAINT fk_line_items_products REFERENCES products(id)"
6. t.integer :order_id,:null => false, :options =>
7. "CONSTRAINT fk_line_items_orders ReEFERENCES orders(id)"
8. t.integer :quantity, :null => false
9. t.decimal :total_price, :null => false,:precision => °Ë,:scale => ¶þ
10. t.timestamps
11. end
12.end
13.
14.def self.down
15. drop_table :line_items
16.end
17.d
class CreateLineItems < ActiveRecord::Migration
def self.up
create_table :line_items do |t|
t.integer :product_id, :null => false,:options =>
"CONSTRAINT fk_line_items_products REFERENCES products(id)"
t.integer :order_id,:null => false, :options =>
"CONSTRAINT fk_line_items_orders ReEFERENCES orders(id)"
t.integer :quantity, :null => false
t.decimal :total_price, :null => false,:precision => °Ë,:scale => ¶þ
t.timestamps
end
end
def self.down
drop_table :line_items
end
end
t.integer :product_id, :null => false,:options =>
"CONSTRAINT fk_line_items_products REFERENCES p


Ïà¹ØÎĵµ£º

rubyµ÷ÓÃDLL

 ¿ªÔ´²âÊÔ¹¤¾ßwatirÊDzÉÓõÄrubyÓïÑÔ½øÐпª·¢µÄ¡£ÔÚÑо¿watir¿ò¼ÜµÄʱºò£¬·¢ÏÖÓÐÒ»²¿·Öº¯ÊýwatirûÓÐÌṩ¶øÇÒÔÝʱûÕÒµ½ºÏÊʵÄgem°ü£¬¶øºÜ¶à¹¦ÄÜÔÚÎÒÃÇÔ­À´µÄ×Ô¶¯»¯²âÊÔ¿ò¼ÜÖж¼Í¨¹ýcдµÄdll½øÐÐÁËʵÏÖ£¬ÓÚÊÇÎÒÃÇÏ£ÍûÄܹ»°ÑÕⲿ·ÖµÄdllÎÞ·ìµÄÒÆÖ²µ½watirÉÏ£¬¼õÉÙÎÒÃǵŤ×÷Á¿£¬¶øÇÒ¿ÉÒÔ¸ü¸ßЧµÄʵÏÖÎÒÃÇÐèÒªµÄ¹¦ÄÜ¡£
......

Ruby¿ìËÙÈëÃÅ£¨¶þ£©£º±äÁ¿

ÉÏһƪÎÄÕÂ
˵ÁËRubyµÄ°²×°ºÍÔËÐУ¬Ò²¼òµ¥µÄ˵ÁËÏÂÀàºÍ¶ÔÏó¡£ÕâÀïÖ÷Ҫ̸̸±äÁ¿µÄÎÊÌâ¡£
ÏÈ˵³£Á¿
¡£Èç¹û±äÁ¿ÃûÒÔ´óд×Öĸ¿ªÍ·£¬¾Í±»ÊÓΪ³£Á¿£¬µ«Í¨³£ÊÇËùÓÐ×Öĸ¶¼´óд¡£µ«ºÍÆäËûÓïÑÔ²»Í¬£¬ÔÚRubyÖУ¬ÄãÈÔÈ»¿ÉÒԸı䳣Á¿µÄÖµ£¬µ±È»½âÊÍÆ÷»áÅ׳öÒ»¸ö¾¯¸æ£º
#! /usr/bin/ruby
CONSTANT = 1
print "#{CONSTANT}\n&qu ......

Ruby 101£º·½·¨¶ÔÏó


Ruby 101£º·½·¨¶ÔÏó
Written by Allen Lee
´Ó·½·¨µ÷ÓÃ˵Æð
      ÔÚÉÏһƪÎÄÕÂÀÎÒÃÇ¿´µ½µ÷ÓöÔÏóµÄ·½·¨ÊµÖÊÉÏÊÇÏò¶ÔÏó·¢ËÍÏûÏ¢£¬ÏÂÃ棬ÎÒÃÇÔÙÀ´¿´Ò»¸öÓÐȤµÄÓ¦Óá£ÔÚRubyÀ×Öµä¿ÉÒÔͨ¹ý {key => value} À´´´½¨£¬Èç¹ûÄãʹÓõİ汾ÊÇ1.9»òÒÔÉÏ£¬µ±keyµÄÀàÐÍÊÇSymbolʱ£¬´´½¨×ÖµäµÄÓ ......

ruby c++

While looking for information on the subject, I looked into the ONLamp article Extending Ruby with C by Garrett Rooney, the Extending Ruby chapter in the Pickaxe, README.EXT (located at /usr/share/doc/ruby1.8-dev/README.EXT.gz on my Ubuntu system) and got some help from Kjetil.
The resulting file c ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ