File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,10 @@ def new
118118 end
119119
120120 @content . save!
121+
122+ # If the user doesn't have this content type enabled, go ahead and automatically enable it for them
123+ current_user . user_content_type_activators . find_or_create_by ( content_type : @content . class . name )
124+
121125 return redirect_to edit_polymorphic_path ( @content )
122126 else
123127 return redirect_to ( subscription_path , notice : "#{ @content . class . name . pluralize } require a Premium subscription to create." )
@@ -186,6 +190,9 @@ def create
186190 end
187191 end
188192
193+ # If the user doesn't have this content type enabled, go ahead and automatically enable it for them
194+ current_user . user_content_type_activators . find_or_create_by ( content_type : content_type . name )
195+
189196 successful_response ( content_creation_redirect_url , t ( :create_success , model_name : @content . try ( :name ) . presence || humanized_model_name ) )
190197 else
191198 failed_response ( 'new' , :unprocessable_entity , "Unable to save page. Error code: " + @content . errors . to_json . to_s )
You can’t perform that action at this time.
0 commit comments