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£¨Í³Ò»µÄº¯ÊýÓï·¨£©”£¬¾¡¹Ü²»Êܱê׼ίԱ»á´ý¼û£¨Á½Äê¼äÀú¾ËÄ´ÎÑÓ³Ù±í¾ö£¬Á½´Î²»Óèͨ¹ý£©£¬ÈÔÈ»“ÍçÇ¿µØ”ÍÆ³öÁ ......
ÕÕÀý¿ÉÒÔÏÈ¿´¶Ë³ÌÐò
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
......
http://www.gayathri-frenzy.com/technology/ruby-on-rails
I kept thinking for a while on what do I have next in the store
Here we go “Ruby on Rails”
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby Programming language.Ruby is a ......