2011-01-28 2 views
2

이것은 쉬운 것이어야하지만 대답은 찾을 수 없습니다! 내 레일 폼 나는authenticity_token 양식에서 생성 된 div에서 불필요한 div를 제거하십시오.

이 제거 할 사업부를 생성 내가 form_authenticity_token

를 사용한다 제안 된 몇 가지 미리보기 질문에 대한보고가 있었다

<div style="margin:0;padding:0;display:inline"><input name="utf8" type="hidden" value="&#x2713"/><input name="authenticity_token" type="hidden" value="Z6UAdFYt3v8d1lx4BNXq5td3OMJ223i+ruKM8Ldb+5s=" /></div> 

나를 위해 생성 레일 사업부입니다

대신 코드에서 form_authenticity_token을 대신 사용할 수 있습니까?

답변

1

어떤 레일 버전을 사용하고 있습니까?

이유를 모르겠다. CSS 문제라면 좀 더 구체적 일 수 있습니다. 나는 이것을 할 필요가 전혀 없다. 그러나 ...

3.0.9에서 작업을 수행하는 방법은 초기화를 제작하고이 코드를 추가 할 것입니다 :

module ActionView 
    module Helpers 
    module FormHelper 
     def extra_tags_for_form(html_options) 
      snowman_tag = tag(:input, :type => "hidden", 
          :name => "utf8", :value => "&#x2713;".html_safe) 

      method = html_options.delete("method").to_s 

      method_tag = case method 
      when /^get$/i # must be case-insensitive, but can't use downcase as might be nil 
       html_options["method"] = "get" 
       '' 
      when /^post$/i, "", nil 
       html_options["method"] = "post" 
       token_tag 
      else 
       html_options["method"] = "post" 
       tag(:input, :type => "hidden", :name => "_method", :value => method) + token_tag 
      end 

      tags = snowman_tag << method_tag 
      content_tag(:span, tags, :style => 'margin:0;padding:0;display:inline') 
     end 
    end 
end 
+0

내가 비슷한 CSS 문제가 있었다. 나는 first-child pseudo-selector를 사용하고 싶었다. 첫 아이는 항상 숨겨진 div이므로 작동하지 않습니다. – memical

관련 문제