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

Ruby on RailsÖÐselectʹÓ÷½·¨

ÔÚRuby on RailsÖÐÕæµÄÓÐÒ»¶ÑSelect helper¿ÉÒÔÓÃ,ÎÒÃǾ­³£ÈÝÒ×»ìÏý¡£³£¼ûµÄÓÐÈý¸ö..
select, select_tag, collection_select(ÆäÓàµÄʲôselect_dateÄÇЩ²»Ì¸)
ÎÒÃÇÏÈÀ´¿´¿´Ò»¸ö»ù±¾µÄÏÂÀ­Ê½Ñ¡Ïî¹Ç¼Ü
</p>
<select
name="ROR">
<option
value="1">ROR1</option><br
/>
<option
value="2">ROR2</option><br
/>
<option
value="3">ROR3</option><br
/>
</select>
<p>
ÔÚÒ»¸öÏÂÀ­Ê½Ñ¡ÏîÖУ¬ÓÐһЩÊDZر¸µÄÐÅÏ¢£¬Ïñ”name”¡¢”value”Óë”text”Èý¸ö£¬Ôڻش«ÐÅÏ¢¸øServeʱ£¬”name”½«ÊǽÓÊÕÐÅÏ¢Óõģ¬¶ø”value”»á´«»Ø±»Ñ¡µÄÖµ£¬¶ø”text”ÔòÊÇʹÓÃÕ߻ῴµ½µÄ×Ö£¬ÒÀÉÏÃæµÄÀý×ÓÀ´½²£¬ROR1¡¢ROR2¡¢ROR3¾ÍÊÇÊôÓÚ”text”
¿ªÊ¼½²½²ÄÄÈýÖÖSelect helper
select:
select(object, method, choices, options = {}, html_options = {})
ÔÚActionView::Helpers::FormOptionsHelperÖж¨Òå
objectÊÂÒ»¸öʵÌ廯±äÊý£¬ÕâÀïºÜÃ÷ÏԵľÍÊÇÒª°ÚÉÏmodelÎï¼þÂ
methodÔòÊÇobjectµÄÒ»¸öÊôÐÔ£¬Ò²ÊÇ×ÊÁϱíÖеĶÔÓ¦ÏîÄ¿
choices¾ÍÊÇÒª±»Ñ¡µÄÑ¡Ï¿ÉÒÔÊÂÕóÁлòÕßʹþÏ£(Hash)
optionsÓëhtml_optionsÔòÊÇһЩѡÏî
À´ÕâÀï¾Ù¸öÀý×Ó°É
<%= select("project", "teacher_id", @teachers.collect{|t| [t.name, t.id]}, { :include_blank => false }) %>
<%= select("project", "student_id", {"CFC" => '1', "EF" => '2'}) %>
µÚÒ»¸öÀý×ÓÖУ¬@teachersÔÚControllerÊÇÕâÑùµÄ
@teachers = Teacher.find(:all, :select => 'id, name')
select_tag:
select_tag(name, option_tags = nil, options = {})
ÔÚActionView::Helpers::FormTagHelperÖж¨Òå
Èç¹ûÄãºÜϲ»¶¶¯ÊÖ´òoptionµÄ»°.. ÄÇÓÃselect_tag׼û´íÀ²£¡
ÔÚselect_tagÖУ¬name½«»áÊÇparamsËù½ÓÊÕÖµËùÓõļü
Ö±½Ó¿´·¶Àý
<%= select_tag
'user', "<option>CFC</option>" %>
ÕâʱÔÚControllerÖн«»áÓÃparams[:user]À´½ÓÊÕ´«¹ýÀ´µÄÖµ
µ«ÊÇselect_tagÒ²¿ÉÒÔ´îÅäoptions_for_select»òÕßoptions_from_collection_for_selectÒ»ÆðʹÓÃ.. À´¿´Ò»¸ö·¶Àý°É
<%= select_tag('sid[]', options_from_collection_for_select(@students, 'id', 'name'), :multiple => true)%>


Ïà¹ØÎĵµ£º

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,
                  ......

Rubyѧϰ±Ê¼ÇÈý——Àà


#Ò»¡¢¶¨ÒåÒ»¸öÀà
class Person
  def initialize(name,age=18)
    @name=name;
    @age=age;
    @motherland="china";
  end
  def talk
    puts "my name is "+@name+" and I am "+@age.to_s
   &nb ......

Fix Thrift 0.2.0 Installation with Ruby 1.9.1

When I try the command "gem install thrift" with Ruby 1.9.1, I got a compilation error with something related to a C function "strlcpy()".
Then I searched the web. It seems I am not alone and the community know it.
However I do not want to wait for official update, I want to ......

ÓÃrubyдµÄwebץȡС¹¤¾ß

×î½üÓÉÓÚѧϰʹÓÃlinuxϵÄC¿ª·¢£¬ÐèÒª²éѯLinux Cº¯Êý²Î¿¼£¬¾Í¾­³£ÉÏhttp://man.chinaunix.net/develop/c&c++/linux_c/default.htm²é¿´£¬ÃèÊöµÃ±È½ÏÏêϸ¶øÇÒ»¹ÓÐÀý×Ó¡£
ÍøÉÏ»¹ÓÐÐí¶à¸÷ÖÖ¼¼ÊõµÄÍøÒ³¸ñʽµÄ²Î¿¼²ÄÁ϶¼·Ç³£Ç¿´ó£¬¿ÉϧºÜ¶àʱºò¶¼Ã»ÓÐÍø¡£ÓÚÊǾÍÏëд¸ö½Å±¾¿ÉÒÔ°ÑÎĵµÏÂÔØ£¬Ïñandroid¿ª·¢ÕßÎĵµÒ»ÑùŪµ½±¾µØ ......

Ñ¡Ruby»¹ÊÇÑ¡Python

 
  ¡¡×î½ü£¬ÎÒÐèÒªÒ»ÖÖ¿ìËÙ¿ª·¢ÓïÑÔ£¬Ä¿Ç°ÖËÊÖ¿ÉÈȵĿìËÙ¿ª·¢ÓïÑÔ¾ÍÊÇPythonºÍRubyÁË¡£RubyºÍPython¶¼ÊǷdz£ÓÅÐãµÄ½Å±¾ÓïÑÔ£¬ËäÈ»ËûÃǵÄÉè¼ÆÕÜѧ¼¸ºõÍêÈ«²»Í¬£¬µ«ËûÃÇЧÂʲ¶à£¬Ó¦ÓÃÁìÓòÒ²²î¾à²»´ó£¬ËƺõÌìÉú¾ÍÊǾºÕù¶ÔÊÖ¡£µ½µ×Ñ¡ÄǸöÄØ?ÎÒ×öÁËһЩ¼òµ¥µÄ±È½Ï¡£  
   
  ¡¡¡¡ÎÒÃDZȽ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ