ruby on rails ½â¾ömultiple select ´æ´¢ºÍupdate
²Ù×÷ϵͳubuntu£¬¿ª·¢¹¤¾ßnetbeans
vendorÊý¾Ý¿â±íÓÐ×Ö¶Îservice_category varchar(100)
<% form_for :vendor, @vendor, :url => sellers_path do |f| %>
<%= f.select(:service_category,
["Painting","Plumbing","Decor"], {}, {:multiple => true, :size => 3}) %>
<%= f.submit "Register"%>
<% end %>
url Ö¸¶¨µ½Äĸöcontrol action£¬ÓõÄÊÇrails rest¼¼Êõ
µ«ÊÇ´æÈëÊý¾Ý¿â±íµÄÊÇ--\painting --Ö®ÀàµÄ×Ö·û´®£¬²»·ûºÏÒªÇó
ËùÒÔÔÚvendor modelÖмÓÈë
def service_category=(values)
if !values.nil?
write_attribute('service_category', values.join(','))
end
end
def service_category
if !read_attribute('service_category').nil?
read_attribute('service_category').split(',')
end
end
´æÈëÊý¾Ý¿âÖеÄÊÇpainting£¬plumbing
ÔÚupdate actionÖÐ@vendor = Vendor.find(id)
ÔÚupdate Ò³Ãæ<%= f.select(:service_category,
["Painting","Plumbing","Decor"], {}, {:multiple => true, :size => 3}) %>¾ÍÄÜÈ¡³öÊý¾Ý¿âÖжÔÓ¦µÄÊý¾Ý
Ïà¹ØÎĵµ£º
Ò»£¬Ruby°²×°£º
http://rubyforge.org/frs/download.php/29263/ruby186-26.exe
¹Ù·½ÍøÕ¾ÏÂÔØruby186-26(for windows)£¬Ä¬Èϰ²×°ruby£»
·¾¶c:\ruby
¶þ£¬railsÏÂÔØ°²×°£º
http://rubyforge.org/frs/download.php/29361/rails-2.0.2.zip
ÏÂÔØrails2.0.2.zip£¬½«ÆäcopyÖÁruby°²×°Â·¾¶£¬²¢¸ÄÃûΪrails.zip£»
³¢ÊÔ²»½âÑ¹Ö ......
require 'win32ole'
excel = WIN32OLE::new('excel.Application')
workbook = excel.Workbooks.Open('E:\RubyApp\bmk.xls')
worksheet = workbook.Worksheets(1) #get hold of the first worksheet
worksheet.Select #bring it to the front -need sometimes to run macros, not for working with a worksheet from ru ......
¹ØÓÚC++0x
Ô¤¼ÆÓÚÃ÷Äêµ×ÍÆ³öµÄбê×¼C++0x£¬Ëä˵ÒѽӽüÊչٽ׶Σ¬È´ÈÔÓÐÈô¸ÉÓдý½ÓÄɵÄÐÂÌá°¸±»Ìá³ö¡£ÓÈÆäÖµµÃ¹Ø×¢µÄÊÇ£¬Óëlambda±í´ïʽÒÔ¼°¾Ö²¿º¯ÊýÏà¹ØµÄÌá°¸“Unified Function Syntax£¨Í³Ò»µÄº¯ÊýÓï·¨£©”£¬¾¡¹Ü²»Êܱê׼ίԱ»á´ý¼û£¨Á½Äê¼äÀú¾ËÄ´ÎÑÓ³Ù±í¾ö£¬Á½´Î²»Óèͨ¹ý£©£¬ÈÔÈ»“ÍçÇ¿µØ”ÍÆ³öÁ ......
ÕÕÀý¿ÉÒÔÏÈ¿´¶Ë³ÌÐò
class Person
def initialize( name,age=18 )
@name = name
@age = age
@motherland = "China"
end
def talk
puts "my name is "+@name+", age is "+@age.to_s
&n ......