Created
March 7, 2013 08:39
-
-
Save nantekkotai/5106498 to your computer and use it in GitHub Desktop.
【Railsで】Vanityのセットアップ【A/Bテスト】 ref: http://qiita.com/items/87a71c6d4a6fe971c2da
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
use_vanity :current_user | |
protected | |
def current_user | |
session[:user_id] | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 以下を追加 | |
Vanity.playground.collecting = true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem 'vanity' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- リンク部分のみ表示 --> | |
<a href="<%= new_post_path %>"><%= ab_test :post_labels %></a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
metric "Post" do | |
description "おお!おおおおお!!!" | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ab_test "Post labels" do | |
description "投稿画面へのリンクテキストを比較" | |
alternatives '記事を投稿する', 'ブログを投稿する', 'つぶやく' | |
metrics :post | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def new | |
@post = Post.new | |
# 以下の一行を追加 | |
track! :post |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 以下を追加 | |
match '/vanity(/:action(/:id(.:format)))', :controller=>:vanity |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
adapter: redis | |
database: redis://localhost:6379/0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class VanityController < ApplicationController | |
include Vanity::Rails::Dashboard | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment