Sha256: 4f10fc2e12288b2dc6377c57d682b74fb9eb734d788f2207d96c38013995f94d

Contents?: true

Size: 763 Bytes

Versions: 4

Compression:

Stored size: 763 Bytes

Contents

module Vanity
  module Rails
    # Step 1: Add a new resource in config/routes.rb:
    #   map.vanity "/vanity/:action/:id", :controller=>:vanity
    #
    # Step 2: Create a new experiments controller:
    #   class VanityController < ApplicationController
    #     include Vanity::Rails::Dashboard
    #   end
    #
    # Step 3: Open your browser to http://localhost:3000/vanity
    module Dashboard
      def index
        render Vanity.template("_report"), :content_type=>Mime::HTML, :layout=>true
      end

      def chooses
        exp = Vanity.playground.experiment(params[:e])
        exp.chooses(exp.alternatives[params[:a].to_i].value)
        render :partial=>Vanity.template("experiment"), :locals=>{ :experiment=>exp }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
mikeg-vanity-1.3.0 lib/vanity/rails/dashboard.rb
vanity-1.2.0 lib/vanity/rails/dashboard.rb
vanity-1.1.1 lib/vanity/rails/dashboard.rb
vanity-1.1.0 lib/vanity/rails/dashboard.rb