タスク/タスクを検出してビューに渡すことを目的としたコントローラーの懸念があります。
私のアプリケーション レイアウトには、これらのタスクをレンダリングするためのスペースが確保されています
<%= yield(:tasks) if content_for?(:tasks) %>
これが、ApplicationController に含めるモジュールです。正しく動作していないようで、content_for?(:tasks)
false が返されます (byebug によると)
module TaskControl
extend ActiveSupport::Concern
included do
before_action :check_tasks
def check_tasks
if user_signed_in? and current_user.tasks.todos.any?
# TODO : better task strategy afterwards
view_context.provide(:tasks,
view_context.cell(:tasks, current_user.tasks.todos.first)
)
end
view_context.content_for?(:tasks) # => false :'(
end
end
end
byebugで確認したことに注意してください。
view_context.cell(:tasks, current_user.tasks.todos.first).blank? # => false, so there is something to render