summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/controllers/user_callouts_controller.rb10
1 files changed, 3 insertions, 7 deletions
diff --git a/app/controllers/user_callouts_controller.rb b/app/controllers/user_callouts_controller.rb
index aa048a9a1fc..18cde4a7b1a 100644
--- a/app/controllers/user_callouts_controller.rb
+++ b/app/controllers/user_callouts_controller.rb
@@ -1,6 +1,6 @@
class UserCalloutsController < ApplicationController
def create
- if check_feature_name && ensure_callout
+ if ensure_callout.persisted?
respond_to do |format|
format.json { head :ok }
end
@@ -13,15 +13,11 @@ class UserCalloutsController < ApplicationController
private
- def check_feature_name
- UserCallout.feature_names.keys.include?(callout_param)
- end
-
def ensure_callout
- current_user.callouts.find_or_create_by(feature_name: callout_param)
+ current_user.callouts.find_or_create_by(feature_name: UserCallout.feature_names[feature_name])
end
- def callout_param
+ def feature_name
params.require(:feature_name)
end
end