0

カスタム FormBuilder を作成していますが、以下のメソッドの出力がなぜ表示されるのかわかりません

def submit(label = "Save changes", *args)
  options = args.extract_options!
  new_class = options[:class] || "btn btn-small btn-success"
  @template.content_tag(:div, :class => "form-actions left") do
    @template.content_tag(:button, :class => new_class, :name => 'commit', :type => 'submit', :value => label) do
      @template.content_tag(:i, :class => 'icon-arrow-right icon-on-right')
    end
  end
end

は:

<div class="form-actions left">
    <button class="btn btn-small btn-success" name="commit" type="submit" value="Salvar">
         <i>{:class=&gt;&quot;icon-arrow-right icon-on-right&quot;}
         </i>
    </button>
</div>

特に「i」タグ。どうすれば修正できますか?ありがとう。

4

1 に答える 1

1

したがって、content_tag がブロックを取得すると、ブロックの結果がタグのコンテンツとして使用されます。ブロックがない場合、2 番目のパラメーターはコンテンツです。おそらくあなたが望むのは

@template.content_tag(:i, nil, :class => 'icon-arrow-right icon-on-right')
于 2013-05-21T15:32:17.537 に答える