gem split的使用方法gem split的使用方法是指如何使用gem split
★Heroku的配置
添加Redis Cloud 25。
namespace = [Rails.application.class.parent_name, Rails.env].join ':'
if Rails.env == "development"
Redis.current = Redis::Namespace.new(namespace, Redis.new(host: '127.0.0.1', port: 6379))
else
if ENV["REDISCLOUD_URL"]
$redis = Redis.new(:url => ENV["REDISCLOUD_URL"])
end
end
unless Rails.env == "development"
Split.redis = $redis
Split::Dashboard.use Rack::Auth::Basic do |username, password|
username == 'admin' && password == Rails.application.config.admin_password
end
end
★Rails的配置
<% ab_test("item_show","list-type","card-type") do |pattern| %>
<% if pattern == "list-type" %>
-- code here --
<% elsif pattern == "card-type" %>
-- code here --
<% end %>
finished('item_show', :reset => false)