0

RubyonRailsは初めてです。

アクションでは、エンコードされたコンテンツを含むパーシャルを動的に生成し、data-uriを介してポップアップとして表示する必要があります。

コントローラ

def dashboard
    @surprise = get_deal(srand % current_user.dob_year)
end

def get_deal(magic_number)
    if magic_number < 500
      return "<h5>You have won a voucher #{VoucherFactory.unused_in_the_queue}</h5>"
    end
end

今、私:partial=>@surpriseはファイルを保存せずにのようなものが必要です。

4

1 に答える 1

1

@surpriseをビューに表示するだけです。

<div id="surprise-area" ..>
    <%= @surprise %>
</div>
于 2012-07-02T23:23:58.110 に答える