Remove the create action from CommentableActions

We were only using it in one place: the debates controller. All the
other controllers including CommentableActions were overwriting this
action, except the ones in the admin area, where creating proposals,
debates or investments isn't possible.

Note this means that, most of the times, we weren't tracking events
creating a resource.

Also note that since, as mentioned in commit 3752fef6b, there are no
geozones in the debates form, we don't have to load them when creating a
debate fails due to validation rules.
This commit is contained in:
Javi Martín
2024-04-23 23:12:30 +02:00
parent 08fc6e81cf
commit 1ee30c0bb7
2 changed files with 12 additions and 15 deletions

View File

@@ -44,21 +44,6 @@ module CommentableActions
@resources = @search_terms.present? ? resource_relation.search(@search_terms) : nil
end
def create
@resource = resource_model.new(strong_params)
@resource.author = current_user
if @resource.save
track_event
redirect_path = url_for(controller: controller_name, action: :show, id: @resource.id)
redirect_to redirect_path, notice: t("flash.actions.create.#{resource_name.underscore}")
else
load_geozones
set_resource_instance
render :new
end
end
def edit
end