diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d83690e..85da787 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,4 +2,11 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + + protected + + def current_ip_address + # request.env['HTTP_X_FORWARDED_FOR'] || + request.remote_ip + end end diff --git a/app/controllers/talk_preferences_controller.rb b/app/controllers/talk_preferences_controller.rb index 8de38ad..8a9c48c 100644 --- a/app/controllers/talk_preferences_controller.rb +++ b/app/controllers/talk_preferences_controller.rb @@ -10,6 +10,7 @@ class TalkPreferencesController < ApplicationController def create @talk_preference = TalkPreference.new talk_preference_params + @talk_preference.ip_address = current_ip_address if @talk_preference.save render json: {