Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby f、 标签不适用于haml中的块_Ruby_Ruby On Rails 3_Haml - Fatal编程技术网

Ruby f、 标签不适用于haml中的块

Ruby f、 标签不适用于haml中的块,ruby,ruby-on-rails-3,haml,Ruby,Ruby On Rails 3,Haml,我有以下haml代码 form_for @user_notification_settings_form do |f| = f.label :follow do div dummy 但它会产生 <label for="user_notification_settings_form_follow"> foruser_notification_settings_form_follow </label> 只需创建%div元素,然后将标签的文本嵌套在其中 fo

我有以下haml代码

form_for @user_notification_settings_form do |f|
  = f.label :follow do
    div dummy
但它会产生

<label for="user_notification_settings_form_follow">
  foruser_notification_settings_form_follow
</label>

只需创建
%div
元素,然后将标签的文本嵌套在其中

form_for @user_notification_settings_form do |f|
  = f.label :follow do
    %div 
      dummy

是否有任何原因导致
%div
  def label_tag(name = nil, content_or_options = nil, options = nil, &block)
    options = content_or_options if block_given? && content_or_options.is_a?(Hash)
    options ||= {}
    options.stringify_keys!
    options["for"] = sanitize_to_id(name) unless name.blank? || options.has_key?("for")
    content_tag :label, content_or_options || name.to_s.humanize, options, &block
  end
  def content_tag(name, content_or_options_with_block = nil, options = nil, escape = true, &block)
    if block_given?
      options = content_or_options_with_block if content_or_options_with_block.is_a?(Hash)
      content_tag_string(name, capture(&block), options, escape)
    else
      content_tag_string(name, content_or_options_with_block, options, escape)
    end
  end
form_for @user_notification_settings_form do |f|
  = f.label :follow do
    %div 
      dummy