Rails Wicked Gem - Flash消息

时间:2016-04-26 11:50:37

标签: ruby-on-rails ruby flash wicked-gem

我有一个广告系列模型,我正在使用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

我想在向导的每个步骤中添加flash消息(成功/错误)。

有没有办法将我的消息作为选项{} 传递给 render_wizard

1 个答案:

答案 0 :(得分:1)

你应该能够实现这个目标: flash[:notice] = "Campaign successfully updated