HAML - 不一致的缩进:1个用于缩进的选项卡,但文档的其余部分使用2个空格缩进

时间:2015-07-21 09:34:24

标签: ruby-on-rails haml

显示错误:缩进不一致:1个缩进用于缩进,但文档的其余部分在第12行使用2个空格缩进

为什么在这个页面上显示错误haml。空间为什么出错?我在任何地方使用2个空格

%h1= title "Новый опрос"
= simple_form_for @poll do |f|
  = f.error_messages header_message: nil
  = f.input :question, disabled: !@poll.editable?(current_user), input_html: { class: 'input-block-level' }
  = f.input :results_hidden, as: :boolean, inline_label: 'Скрыть результаты до окончания опроса', label: false
  = f.input :from_date, as: :datetime, input_html: { class: 'poll_date' }
  = f.input :to_date, as: :datetime, input_html: { class: 'poll_date' }
  .item_index  
    = f.simple_fields_for :poll_items do |poll|
      = render 'poll_item_fields', f: poll
    = link_to_add_association 'Добавить еще вариант', f, :poll_items
    .form-actions
      = f.button :submit, 'Опубликовать опрос', class: 'btn-bg'
      %p 
        Вернуться к посту:
        = link_to @owner

来自页面new.html.haml的完整跟踪:

app/views/polls/new.html.haml:12
haml (4.0.6) lib/haml/parser.rb:174:in `block in tabs'
haml (4.0.6) lib/haml/parser.rb:152:in `instance_eval'
haml (4.0.6) lib/haml/parser.rb:152:in `tabs'
haml (4.0.6) lib/haml/parser.rb:751:in `block_opened?'
haml (4.0.6) lib/haml/parser.rb:122:in `parse'
haml (4.0.6) lib/haml/engine.rb:66:in `initialize'
haml (4.0.6) lib/haml/template/plugin.rb:25:in `new'
haml (4.0.6) lib/haml/template/plugin.rb:25:in `compile'
haml (4.0.6) lib/haml/template/plugin.rb:30:in `call'
actionpack (3.2.22) lib/action_view/template.rb:268:in `compile'
actionpack (3.2.22) lib/action_view/template.rb:244:in `block in compile!'
actionpack (3.2.22) lib/action_view/template.rb:232:in `synchronize'
actionpack (3.2.22) lib/action_view/template.rb:232:in `compile!'
actionpack (3.2.22) lib/action_view/template.rb:144:in `block in render'
activesupport (3.2.22) lib/active_support/notifications.rb:125:in `instrument'
actionpack (3.2.22) lib/action_view/template.rb:143:in `render'
rack-mini-profiler (0.9.6) lib/mini_profiler/profiling_methods.rb:106:in `block in profile_method'
actionpack (3.2.22) lib/action_view/renderer/template_renderer.rb:47:in `block (2 levels) in render_template'
actionpack (3.2.22) lib/action_view/renderer/abstract_renderer.rb:38:in `block in instrument'
activesupport (3.2.22) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.22) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.22) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.22) lib/action_view/renderer/abstract_renderer.rb:38:in `instrument'
actionpack (3.2.22) lib/action_view/renderer/template_renderer.rb:46:in `block in render_template'
actionpack (3.2.22) lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
actionpack (3.2.22) lib/action_view/renderer/template_renderer.rb:45:in `render_template'
actionpack (3.2.22) lib/action_view/renderer/template_renderer.rb:18:in `render'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:150:in `block in render_with_newrelic'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/method_tracer.rb:73:in `block in trace_execution_scoped'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/method_tracer_helpers.rb:82:in `trace_execution_scoped'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/method_tracer.rb:71:in `trace_execution_scoped'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:149:in `render_with_newrelic'
actionpack (3.2.22) lib/action_view/renderer/renderer.rb:36:in `render_template'
actionpack (3.2.22) lib/action_view/renderer/renderer.rb:17:in `render'
actionpack (3.2.22) lib/abstract_controller/rendering.rb:110:in `_render_template'
actionpack (3.2.22) lib/action_controller/metal/streaming.rb:225:in `_render_template'
actionpack (3.2.22) lib/abstract_controller/rendering.rb:103:in `render_to_body'
actionpack (3.2.22) lib/action_controller/metal/renderers.rb:28:in `render_to_body'
actionpack (3.2.22) lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
actionpack (3.2.22) lib/abstract_controller/rendering.rb:88:in `render'
actionpack (3.2.22) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (3.2.22) lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
activesupport (3.2.22) lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/home/dima/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
activesupport (3.2.22) lib/active_support/core_ext/benchmark.rb:5:in `ms'
actionpack (3.2.22) lib/action_controller/metal/instrumentation.rb:40:in `block in render'
actionpack (3.2.22) lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
activerecord (3.2.22) lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
thinking-sphinx (2.0.14) lib/thinking_sphinx/action_controller.rb:12:in `cleanup_view_runtime'
actionpack (3.2.22) lib/action_controller/metal/instrumentation.rb:39:in `render'
actionpack (3.2.22) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (3.2.22) lib/action_controller/metal/implicit_render.rb:5:in `send_action'
actionpack (3.2.22) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.22) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.22) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.2.22) lib/active_support/callbacks.rb:458:in `_run__270438694__process_action__945548129__callbacks'
activesupport (3.2.22) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.22) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
activesupport (3.2.22) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.22) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.22) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.22) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.22) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.22) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.22) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.22) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.22) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.22) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:28:in `block in process_action'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:361:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:23:in `process_action'
actionpack (3.2.22) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.22) lib/abstract_controller/rendering.rb:45:in `process'
rack-mini-profiler (0.9.6) lib/mini_profiler/profiling_methods.rb:106:in `block in profile_method'
actionpack (3.2.22) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.22) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.22) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.22) lib/action_dispatch/routing/route_set.rb:73:in `call'
actionpack (3.2.22) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.22) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `block in call'
journey (1.0.4) lib/journey/router.rb:56:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.22) lib/action_dispatch/routing/route_set.rb:608:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/rack/agent_hooks.rb:30:in `traced_call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/rack/browser_monitoring.rb:32:in `traced_call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.4.7) lib/rack/etag.rb:23:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.4.7) lib/rack/conditionalget.rb:25:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/head.rb:14:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/flash.rb:242:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.4.7) lib/rack/session/abstract/id.rb:210:in `context'
rack (1.4.7) lib/rack/session/abstract/id.rb:205:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
config/initializers/flash_session_cookie_middleware.rb:19:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/cookies.rb:341:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
activerecord (3.2.22) lib/active_record/query_cache.rb:64:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
activerecord (3.2.22) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.22) lib/active_support/callbacks.rb:405:in `_run__200222769__call__562425215__callbacks'
activesupport (3.2.22) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.22) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.22) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.22) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/reloader.rb:65:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
airbrake (4.3.0) lib/airbrake/rails/middleware.rb:13:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
railties (3.2.22) lib/rails/rack/logger.rb:32:in `call_app'
railties (3.2.22) lib/rails/rack/logger.rb:16:in `block in call'
activesupport (3.2.22) lib/active_support/tagged_logging.rb:22:in `tagged'
railties (3.2.22) lib/rails/rack/logger.rb:16:in `call'
quiet_assets (1.1.0) lib/quiet_assets.rb:27:in `call_with_quiet_assets'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/request_id.rb:22:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.4.7) lib/rack/methodoverride.rb:21:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.4.7) lib/rack/runtime.rb:17:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.4.7) lib/rack/lock.rb:15:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
actionpack (3.2.22) lib/action_dispatch/middleware/static.rb:83:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack-cache (1.2) lib/rack/cache/context.rb:136:in `forward'
rack-cache (1.2) lib/rack/cache/context.rb:245:in `fetch'
rack-cache (1.2) lib/rack/cache/context.rb:185:in `lookup'
rack-cache (1.2) lib/rack/cache/context.rb:66:in `call!'
rack-cache (1.2) lib/rack/cache/context.rb:51:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
airbrake (4.3.0) lib/airbrake/user_informer.rb:16:in `_call'
airbrake (4.3.0) lib/airbrake/user_informer.rb:12:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack-mini-profiler (0.9.6) lib/mini_profiler/profiler.rb:279:in `call'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
railties (3.2.22) lib/rails/engine.rb:484:in `call'
railties (3.2.22) lib/rails/application.rb:231:in `call'
railties (3.2.22) lib/rails/railtie/configurable.rb:30:in `method_missing'
newrelic_rpm (3.12.1.298) lib/new_relic/agent/instrumentation/middleware_tracing.rb:67:in `call'
rack (1.4.7) lib/rack/content_length.rb:14:in `call'
railties (3.2.22) lib/rails/rack/log_tailer.rb:17:in `call'
thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
thin (1.5.1) lib/thin/connection.rb:79:in `catch'
thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
thin (1.5.1) lib/thin/connection.rb:54:in `process'
thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
eventmachine (1.0.7) lib/eventmachine.rb:187:in `run_machine'
eventmachine (1.0.7) lib/eventmachine.rb:187:in `run'
thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
thin (1.5.1) lib/thin/server.rb:159:in `start'
rack (1.4.7) lib/rack/handler/thin.rb:13:in `run'
rack (1.4.7) lib/rack/server.rb:268:in `start'
railties (3.2.22) lib/rails/commands/server.rb:70:in `start'
railties (3.2.22) lib/rails/commands.rb:55:in `block in <top (required)>'
railties (3.2.22) lib/rails/commands.rb:50:in `tap'
railties (3.2.22) lib/rails/commands.rb:50:in `<top (required)>'
script/rails:23:in `require'
script/rails:23:in `<main>'

1 个答案:

答案 0 :(得分:2)

此错误表示文档的某些部分使用2个空格缩进,而其他部分使用制表符缩进。 您应该统一文件中使用的缩进方法