[Á°][¼¡][ÈÖ¹æ½ç°ìÍ÷][¥¹¥ì¥Ã¥É°ìÍ÷]

rails:1458

From: twata_nabe@y...
Date: Thu, 3 Aug 2006 22:29:45 +0900 (JST)
Subject: [rails:1458] Re: habtm ¤Ç param ¤ò¼õ¤±¼è¤ëÊýË¡

ÊÒÊ¿ÍÍ
¤ï¤¿¤Ê¤Ù¤Ç¤¹¡£
¤´²óÅú¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£
  ¼Â¤Ï°ÊÁ°¤Î¥½¡¼¥¹¤Çparams[:service][:area_id]¤ÇÅÐÏ¿¤Ç¤­¤¿¤Î¤Ç¤¹¤¬¡¢
º£²ó¤ÎÌäÂê¤Ï¡¢»ÅÍͤòÄɲä·¤¿¸å¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£
¸½ºß¤Î»ÅÍͤϤ³¤Î¤è¤¦¤Ë¤Ê¤Ã¤Æ¤ª¤ê¤Þ¤¹¡£
  ¡Ú°ÊÁ°¡Û
¡¡¡¡¡¡          ¡¡[View]¡¡          [Controller]
-------------------------------------------------------
ÅÐÏ¿²èÌÌ        regist.rhtml        def regist
  ³Îǧ²èÌÌ        confirm.rhtml       def confirm
      ¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­¢­
  ¡Ú¸½ºß¡Û
                      ¡¡¡¡¡¡  [View]             ¡¡¡¡¡¡ [Controller]
-----------------------------------------------------------------
ÅÐÏ¿²èÌÌ¡¡¡¡    ¡¡  regist.rhtml(­¡-1)      def regist(­¡-2)
  ¥Ð¥ê¥Ç¡¼¥È¥Á¥§¥Ã¥¯  -                       ¡¡¡¡¡¡def get_regist(­¢-1)
                   ¡¡¡¡¡¡ (¥Á¥§¥Ã¥¯³ºÅö¤Ï
                   ¡¡¡¡¡¡ ­¡-1¤Ë¥ê¥À¥¤¥ì¥¯¥È)  
  ³Îǧ²èÌÌ            confirm.rhtml(­£-1)     def confirm(­£-2)
           
  ºÇ½é¤ÏModel¥¯¥é¥¹¤Ë¥Ð¥ê¥Ç¡¼¥È¤ò¤Ä¤±¤ì¤Ð»ö¤ÏºÑ¤à¤È»×¤Ã¤Æ¤Þ¤·¤¿¤¬¡¢
¡Ö¥é¥¤¥É¥ª¥óRails¡×¤òÆɤߡ¢¡Övalidate¤Ïsave!¤ò¼Â¹Ô¤·¤Æ¤Ï¤¸¤á¤ÆÍ­¸ú¡×
¤È½ñ¤«¤ì¤Æ¤ª¤ê¡¢¥Ç¡¼¥¿¥Ù¡¼¥¹¤ËÅÐÏ¿¤·¤Æ¤¤¤Ê¤¤¾õÂ֤ǤÏÍ­¸ú¤Ç¤Ï¤Ê¤¤¤Î¤«
¤È»×¤¤¡¢paramÊÑ¿ô¤ò°ìÅÙcontroller¤ËÅϤ·¡¢¥Ð¥ê¥Ç¡¼¥È¥Á¥§¥Ã¥¯¤ò¤«¤±¤ë
¤È¤¤¤¦»ÅÍͤËÊѤ¨¤Þ¤·¤¿¡£
  ¤¹¤ë¤È¡¢habtm¤Ç»ý¤Ã¤Æ¤¤¤¿Area¤Ç¥¨¥é¡¼¤¬µ¯¤³¤ê¤Þ¤·¤¿¡£
°Ê²¼¡¢params[:service][:area_id]¤Ë¤·¤¿¤È¤­¤Î¥¨¥é¡¼¤Ç¤¹¡£
------¥¨¥é¡¼ÆâÍÆ-------------------------------------------------
undefined method `area_id=' for #<Service:0x3a58798>
  
RAILS_ROOT: ./script/../config/..
  C:/Program Files/ruby-1.8/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1789:in `method_missing'
C:/Program Files/ruby-1.8/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1510:in `attributes='
C:/Program Files/ruby-1.8/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1509:in `attributes='
C:/Program Files/ruby-1.8/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/base.rb:1354:in `initialize_without_callbacks'
C:/Program Files/ruby-1.8/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/callbacks.rb:236:in `initialize'
#{RAILS_ROOT}/app/controllers/b_account_controller.rb:74:in `get_regist'
  
Request
Parameters: {"b"=>{"agreement"=>"1"}, "submit"=>"\346\254\241\343\201\270", 
"x"=>"17", "y"=>"7", "service"=>{"name_j"=>"sdfsdf", "companyname"=>"sdfsfs",
 "between_a"=>"", "between_b"=>"", "tel"=>"sdfds", 
 "companyaddress"=>"555 Irving, San Francisco, CA", "website"=>"sdfsdf", 
 "manager"=>"sdfsdfs", "area_id"=>"1", "name_e"=>"sdfsfs", "companytel"=>"sdfds", 
 "chargerpost"=>"sfsdf", "charger"=>"sdfsdfs", "secretword"=>"sfsd", 
 "address"=>"555 Irving, San Francisco, CA", "password"=>"aaaaa", 
 "email"=>"sdfsd", "membertype_id"=>"4", "industry_id"=>"1"}, 
 "password"=>{"confirm_password"=>"aaaaa"}, 
 "select"=>"\343\201\212\346\257\215\343\201\225\343\202\223\343\201\256\346\227\247\345\247\223"}
  ------------------------------------------------------------------------------------------------
params[:service][:area_id]¤ò
ÊѤ¨¤ë¤³¤È¤Ç¥¨¥é¡¼¤Ï¤Ê¤¯¤Ê¤ë¤Î¤«¤Ê¤È»×¤¤¡¢
params[:service][:area_ids]¤Ë¤¹¤ë¤È¡¢
undefined method `area_id='¤Ç¤Ï¤Ê¤¯¡¢
Couldn't find Area without an ID
¤Ë¤Ê¤Ã¤¿¤ï¤±¤Ç¤¹¡£
  ÊÒÊ¿¤µ¤ó¤Î¤ª¤Ã¤·¤ã¤ë¤è¤¦¤Ë¡¢params¤¬¤¦¤Þ¤¯µ¡Ç½¤·¤Æ¤¤¤Ê¤¤¤Î¤«¤Ê¤È»×¤Ã¤Æ¤Þ¤¹¡£
  ¥½¡¼¥¹Á´Éô¤òºÜ¤»¤ë¤ÈÆɤߤŤ餯¤Ê¤ë¤Î¤Ç¡¢³ºÅö²Õ½ê¤Î¥½¡¼¥¹¤ò·ÇºÜ¤·¤Þ¤¹¡£
  
ÅÐÏ¿²èÌÌ¡¡¡¡    ¡¡  regist.rhtml(­¡-1)      def regist(­¡-2)
¥Ð¥ê¥Ç¡¼¥È¥Á¥§¥Ã¥¯  -                       def get_regist(­¢-1)
³Îǧ²èÌÌ            confirm.rhtml(­£-1)     def confirm(­£-2)
  ¢£­¡-1
<!--rails start-->
<select id="service_area_id" name="service[area_id]">
<% for area in @area %>
<option value="<%= area.id %>"><%=h area.id %></option>
<% end %>
</select>
<!--rails end-->
¢£­¡-2
def regist
    @area = Area.find(:all)
¡Á°Ê²¼Î¬
¢£­¢-1
def get_regist
    session[:service] = Service.new(params[:service])
    #ÆþÎÏ¥Á¥§¥Ã¥¯
    if  params[:service][:name_e] == "" || 
     params[:service][:charger] == "" ||
     params[:service][:chargerpost] == "" ||
     params[:service][:e_mail] == "" ||
     params[:service][:password] == "" ||
     params[:service][:address] == "" ||
     params[:service][:tel] == "" ||
     params[:service][:manager] == "" ||
     params[:service][:companyname] == "" ||
     params[:service][:companytel] == "" ||
     params[:service][:website] == ""
     if params[:service][:name_e] == ""
      flash[:notice_name_e] = "Ź̾(±Ñ¸ì)¤òÆþÎϤ·¤Æ¤¯¤À¤µ¤¤"
     end
     if params[:service][:charger] == ""
      flash[:notice_charger] = "ôÅö¼Ô¤òÆþÎϤ·¤Æ¤¯¤À¤µ¤¤"
     end
¡ÁÅÓÃæά
        redirect_to :action => "regist",:membertype => params[:service][:membertype_id]
  return
    else
     redirect_to :action => "confirm",:membertype => params[:service][:membertype_id]
 end
¢£­£-1
<!--rails start-->
<td class="txt12nosp"><%= @area_name %></td>
<input id="service_area_id" name="service[area_ids][]" type="hidden" value=<%= @params["service"]["area_ids"] %> />
<!--rails end-->
¢£­£-2
def confirm
    @area_name=Area.find(params[:service][:area_ids]).collect { |area|  
    area.name }
    #@area_name = Area.find(params[:service][:area_ids]).name
      #¤´¶µ¼¨¤¤¤¿¤À¤¤¤¿ÊýË¡¤ò»î¤·¤Þ¤·¤¿¤¬¡¢Couldn't find Area without an ID
    #¤Ç¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£¤ä¤Ï¤êparams¤Î»ØÄêÊýË¡¤¬´Ö°ã¤Ã¤Æ¤¤¤ë¤Î¤«¤Ê¤È
  ¡¡¡¡#»×¤Ã¤Æ¤Þ¤¹¡£
  #¥½¡¼¥¹½ªÎ»
   
  ¤³¤Î¤è¤¦¤Ê³Îǧ²èÌ̤¬¤¢¤ë¾ì¹ç¤Ç¤âModel¥¯¥é¥¹¤Ç»ØÄꤹ¤ëvalidate¤¬
Í­¸ú¤Ë¤Ê¤ëÊýË¡¤¬¤´¤¶¤¤¤Þ¤·¤¿¤é¡¢¤´¶µ¼¨´ê¤¤¤Þ¤¹¡£
 


---------------------------------
Let's start Yahoo! Auction  -  Free Campaign Now!


źÉÕ¥Õ¥¡¥¤¥ë

[Á°][¼¡][ÈÖ¹æ½ç°ìÍ÷][¥¹¥ì¥Ã¥É°ìÍ÷]

   @  1447 2006-08-02 23:29 [twata_nabe@y...     ] habtm ¤Ç param ¤ò¼õ¤±¼è¤ëÊýË¡           
      1456 2006-08-03 04:55 ¨±[yuichi_katahira@m...]                                       
      1457 2006-08-03 05:01 ¡¡¨±[yuichi_katahira@m...]                                     
-> @  1458 2006-08-03 15:29 ¡¡¡¡¨±[twata_nabe@y...     ]                                   
   @  1459 2006-08-03 15:38 ¡¡¡¡¡¡¨²[twata_nabe@y...     ]                                 
      1461 2006-08-04 04:26 ¡¡¡¡¡¡¨±[yuichi_katahira@m...]