2011-03-28 3 views
0

Rails 2.3.9 응용 프로그램을 Rails 3로 업그레이드하려고하는데 문제가 발생합니다. 레일즈 2.3.9 용 자동 완성 플러그인을 사용했는데 정상적으로 작동합니다. 하지만 이제는 Rails 3.0에서 텍스트 상자를 표시하는 대신 생성해야하는 html 만 표시합니다. 다음이 생성 된 HTML이Rails 3.0으로 업그레이드

"<input id="customer_investigator" name="customer[investigator]" onblur="if(this.value=='') {this.value='last, first';this.style.color='#aaa';}" onfocus="if(this.value=='last, first') {this.value='';this.style.color='#000';}" size="30" type="text" /><div class="auto_complete" id="customer_investigator_auto_complete"></div><script type="text/javascript"> 
//<![CDATA[ 
var customer_investigator_auto_completer = new Ajax.Autocompleter('customer_investigator', 'customer_investigator_auto_complete', '/accessions/autocomplete_name', {callback:function(element, value) { return 'name='+element.value }}) 
//]]> 
</script>" 

내용이 나에게 잘 보이는 같은 모습입니다 이제 자동 완성 필드를

<table class="table_style"> 
<caption><b>Customer Details</b></caption> 
<tr> 
<td><label for="customer_investigator"><%= RB['investigator']%></label><label class="mandatory">*</label></td> 
<td><%= text_field_with_auto_complete "customer", :investigator, { :onblur=> "if(this.value=='') {this.value='last, first';this.style.color='#aaa';}",:onfocus=> "if(this.value=='last, first') {this.value='';this.style.color='#000';}"},{:skip_style => true, :url=>{:action=>'autocomplete_name'}, :with =>"'name='+element.value"} %></td> 
</tr> 
</table> 

를 생성 내 html 코드이다. 그러나 생성 된 html은 따옴표로 시작하므로 텍스트 상자를 표시하는 대신 생성 된 html을 양식에 표시합니다. 그것은 Rails 2.3.9와 완벽하게 작동했습니다. 누군가가이 일을 도울 수 있습니까?

감사

답변

1

당신의 자동 완성 코드 앞에 원시를 사용하려고 : 난 항상 레일에 레일 2에서 내 응용 프로그램을 업그레이드 할 rails_upgrade 보석을 사용하고

<%= raw(text_field_with_auto_complete "customer", :investigator, { :onblur=> "if(this.value=='') {this.value='last, first';this.style.color='#aaa';}",:onfocus=> "if(this.value=='last, first') {this.value='';this.style.color='#000';}"},{:skip_style => true, :url=>{:action=>'autocomplete_name'}, :with =>"'name='+element.value"}) %> 
관련 문제