Rails 邪恶 Gem - 闪信

Rails Wicked Gem - Flash Messages

我有一个 Campaign 模型,我正在使用 Wicked Gem 逐步创建活动。

我在向导中总共有 3 个步骤...

steps :details, :audiance, :creatives

这是我的向导控制器

class Brands::CampaignWizardsController < Brands::ApplicationController
  include Wicked::Wizard
  steps :details, :audiance, :creatives

  def show
    @campaign = current_company.campaigns.friendly.find(params[:campaign_id])
    render_wizard
  end

  def update
    case step
      when :details
        @campaign.attributes = campaign_details_params

        @campaign[:dos].delete_if(&:blank?)
        @campaign[:donts].delete_if(&:blank?)

        @campaign_ideas = CampaignIdea.where(objective_id: @campaign.objective_id)

      when :audiance
        @campaign.attributes = campaign_audiance_params

        @campaign[:influencer_interests].delete_if(&:blank?)

      when :creatives
        @campaign.attributes = campaign_creatives_params

    end
    render_wizard @campaign
  end
end

我想在向导的每个步骤中添加即显消息 (success/error)。

有什么方法可以将我的消息作为 选项{} 传递给 render_wizard 吗?

您应该可以通过以下方式实现此目的: flash[:notice] = "Campaign successfully updated.