Search code examples
ruby-on-rails-3vanity

Using Images as Vanity Alternatives


I am trying to use Vanity for rails. my ab_test /rag_price_options.rb file is:

    ab_test "Rag price options" do
      description "Different options for displaying the rag price"
      alternatives "banner_194x117_rag.png", "ccp_logo_bk.png"
      metrics :orders
    end

and my metric metrics/order.rb is:

   metric "Orders" do
     description "Measures number of orders, subtotals, order number"
   end

But I'm trying to figure out how to have 2 images as the alternatives that need to go inside a link to field something like this:

   <%= link_to image_tag("banner_194x117_rag.png", :alt=>'Free Rag with purchase over $99!', :width=>194, :height=>117, :style=>'display:block', :class=>'incentive'), "/blog/free-cheap-cycle-rag" %> 

Solution

  • all i had to do was:

        <%= link_to image_tag(ab_test(:rag_price_options), :alt=>'Free Rag with purchase over $99!', :width=>194, :height=>117, :style=>'display:block', :class=>'incentive'), "/blog/free-cheap-cycle-rag" %>