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}) %>¾ÍÄÜÈ¡³öÊý¾Ý¿âÖжÔÓ¦µÄÊý¾Ý
Ïà¹ØÎĵµ£º
¹ØÓÚC++0x
Ô¤¼ÆÓÚÃ÷Äêµ×ÍƳöµÄбê×¼C++0x£¬Ëä˵ÒѽӽüÊչٽ׶Σ¬È´ÈÔÓÐÈô¸ÉÓдý½ÓÄɵÄÐÂÌá°¸±»Ìá³ö¡£ÓÈÆäÖµµÃ¹Ø×¢µÄÊÇ£¬Óëlambda±í´ïʽÒÔ¼°¾Ö²¿º¯ÊýÏà¹ØµÄÌá°¸“Unified Function Syntax£¨Í³Ò»µÄº¯ÊýÓï·¨£©”£¬¾¡¹Ü²»Êܱê׼ίԱ»á´ý¼û£¨Á½Äê¼äÀú¾ËÄ´ÎÑÓ³Ù±í¾ö£¬Á½´Î²»Óèͨ¹ý£©£¬ÈÔÈ»“ÍçÇ¿µØ”ÍƳöÁ ......
PythonºÍRubyµÄ¶Ô±È£¬¾ÀÕýһЩÎó½â
ÏÂÃæÊÇÎÒÔÚ¿´Á½Æª¹ØÓÚPythonºÍRuby¶Ô±ÈµÄÎÄÕÂʱ£¬Ëù×÷µÄ¾ÀÕý£¬ÔÎĶ¼Êǹ㷺Á÷Ðеģ¬±È½ÏºÃÕÒ¡£
------------------------------------------------------
¡¶rubyºÍpythonµÄ±È½Ï¡·¸üÕýÒ»µãÊÂÇé
1¡¢Îĵµ¡¢¿ªÔ´ÏîÄ¿¡¢¿âÖ§³Ö£¬ÕâЩ¶«Î÷Ruby²»Òª¸úPython±È£¬²»ÊǼ¸¸öÊýÁ¿¼¶µÄÎÊÌ⣬ºÎ±ØÃ²Ë ......
ÕÕÀý¿ÉÒÔÏÈ¿´¶Ë³ÌÐò
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 ......
env setup
linux(ubuntu)ÏÂruby¿ª·¢»·¾³´î½¨£¬°üÀ¨Ò»Ð©³£¼ûÎÊÌâ½â¾ö
×¢Ò⣬±¾ÎÄÖ»ÊÇÎÒÔڴrubyѧϰ»·¾³Ê±µÄһЩ±Ê¼Ç£¬ÒòΪÊÇÓÃgedit±à¼µÄ£¬ËùÒÔ¸ñʽ»¯²»ÊǺܺã¬ÁíÍ⣬ֻÊDZ¸Íü¶øÒÑ¡£
2010.1.19
1. install ruby
$ tar xzf ruby-1.8.7-p248.tar.gz
$ mv ruby-1.8.7-p248 ruby187
$ cd ruby187/
$ ./configure
......
ΪÁËÑ¡ÔñÒ»¸öºÏÊʵĽű¾ÓïÑÔѧϰ£¬½ñÌì²éÁ˲»ÉÙÓйØPerl£¬Python£¬Ruby£¬JavascriptµÄ¶«Î÷£¬¿ÉÊÇ·¢ÏÖ¸÷´óÕóÓªµÄÈ˶¼ÔÚ´µÅõ×Ô¼ºÏ²»¶µÄÓïÑÔ£¬²»¹ý×îûÓÐÕùÒéµÄÓ¦¸ÃÊÇJavascriptÏֽ׶λ¹²»ÊʺÏÓÃÀ´×ö¶ÀÁ¢¿ª·¢£¬ËüµÄÌìÏ»¹ÊÇÔÚwebÓ¦ÓÃÉÏ¡£ ÎÒÖ÷ÒªÊÇÏë×öÊý¾ÝÍÚ¾òËã·¨µÄÑо¿£¬Ó¦¸Ã»á´¦Àí´óÁ¿µÄÎı¾¡£Ìáµ½Îı¾´¦Àí£¬ÏàÐŴ󲿷ÖÈË ......