Rack::Affiliatesをいじっていますが、開発環境のドメイン localhost で動作するかどうかはわかりません。
1ºこれはapplication.rb
ファイル内の私の設定です:
config.middleware.use Rack::Affiliates, {:param => 'aff_id', :ttl => 6.months, :domain => '.localhost'}
2º次のaff_id
ような
リンクとパラメーターを含むメールを送信します。<%= link_to "accept invite", new_user_registration_url(:aff_id => @user.id) %>
3º ルートアクション:
def index
if request.env['affiliate.tag'] && affiliate = User.find_by_affiliate_tag(request.env['affiliate.tag'])
logger.info "Halo, referral! You've been referred here by #{affiliate.name} from #{request.env['affiliate.from']} @ #{Time.at(env['affiliate.time'])}"
else
logger.info "We're glad you found us on your own!"
end
respond_to do |format|
format.html
end
end
コンソールに次のメッセージが表示されます。
We're glad you found us on your own!
私は何を間違っていますか?
ありがとう!