diff --git a/app/controllers/admin/about_pages_controller.rb b/app/controllers/admin/about_pages_controller.rb index aaf5e8426025..743518f57f12 100644 --- a/app/controllers/admin/about_pages_controller.rb +++ b/app/controllers/admin/about_pages_controller.rb @@ -39,7 +39,7 @@ def human_friendly_model_name private def find_topical_event - @topical_event = TopicalEvent.find(params[:topical_event_id]) + @topical_event = TopicalEvent.friendly.find(params[:topical_event_id]) end def find_page diff --git a/app/controllers/admin/classifications_controller.rb b/app/controllers/admin/classifications_controller.rb index 6b70140d0511..091c014b8149 100644 --- a/app/controllers/admin/classifications_controller.rb +++ b/app/controllers/admin/classifications_controller.rb @@ -24,7 +24,7 @@ def edit end def update - @classification = model_class.find(params[:id]) + @classification = model_class.friendly.find(params[:id]) if @classification.update_attributes(object_params) redirect_to [:admin, @classification], notice: "#{human_friendly_model_name} updated" else @@ -33,7 +33,7 @@ def update end def destroy - @classification = model_class.find(params[:id]) + @classification = model_class.friendly.find(params[:id]) @classification.delete! if @classification.deleted? redirect_to [:admin, model_class], notice: "#{human_friendly_model_name} destroyed" @@ -51,7 +51,7 @@ def build_object end def load_object - @classification = model_class.find(params[:id]) + @classification = model_class.friendly.find(params[:id]) end def model_name diff --git a/app/controllers/admin/offsite_links_controller.rb b/app/controllers/admin/offsite_links_controller.rb index e6445c3f70f5..cdb8faaa18c7 100644 --- a/app/controllers/admin/offsite_links_controller.rb +++ b/app/controllers/admin/offsite_links_controller.rb @@ -43,8 +43,8 @@ def show def load_parent @parent = WorldLocation.find(params[:world_location_id]) if params[:world_location_id] @parent = Organisation.find(params[:organisation_id]) if params[:organisation_id] - @parent = Topic.find(params[:topic_id]) if params[:topic_id] - @parent = TopicalEvent.find(params[:topical_event_id]) if params[:topical_event_id] + @parent = Topic.friendly.find(params[:topic_id]) if params[:topic_id] + @parent = TopicalEvent.friendly.find(params[:topical_event_id]) if params[:topical_event_id] end def load_offsite_link diff --git a/app/controllers/admin/topical_events_controller.rb b/app/controllers/admin/topical_events_controller.rb index 92b0a4fbfe48..bb69e0ab35f1 100644 --- a/app/controllers/admin/topical_events_controller.rb +++ b/app/controllers/admin/topical_events_controller.rb @@ -3,12 +3,12 @@ class Admin::TopicalEventsController < Admin::ClassificationsController before_filter :destroy_blank_social_media_accounts, only: [:create, :update] def update - @classification = model_class.find(params[:id]) + @classification = TopicalEvent.friendly.find(params[:id]) if @classification.update_attributes(object_params) if object_params[:classification_featurings_attributes] redirect_to [:admin, @classification, :classification_featurings], notice: "Order of featured items updated" else - redirect_to [:admin, model_class.new], notice: "#{human_friendly_model_name} updated" + redirect_to [:admin, TopicalEvent.new], notice: "#{human_friendly_model_name} updated" end else render action: "edit" diff --git a/app/controllers/topical_events_controller.rb b/app/controllers/topical_events_controller.rb index 32b8f7d6e38a..172c8f5610b6 100644 --- a/app/controllers/topical_events_controller.rb +++ b/app/controllers/topical_events_controller.rb @@ -6,7 +6,7 @@ def index end def show - @classification = TopicalEvent.find(params[:id]) + @classification = TopicalEvent.friendly.find(params[:id]) @policies = @classification.published_policies.includes(:translations, :document) @publications = fetch_associated(:published_publications, PublicationesquePresenter) @consultations = fetch_associated(:published_consultations, PublicationesquePresenter) diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb index e0695b50e4e8..144af9e89c1d 100644 --- a/app/controllers/topics_controller.rb +++ b/app/controllers/topics_controller.rb @@ -2,7 +2,7 @@ class TopicsController < ClassificationsController enable_request_formats show: :atom def show - @classification = Topic.find(params[:id]) + @classification = Topic.friendly.find(params[:id]) respond_to do |format| format.html do diff --git a/db/data_migration/20141015122422_ebola_response_slug_change.rb b/db/data_migration/20141015122422_ebola_response_slug_change.rb index e6e87dc06001..64ae55ba72af 100644 --- a/db/data_migration/20141015122422_ebola_response_slug_change.rb +++ b/db/data_migration/20141015122422_ebola_response_slug_change.rb @@ -1,4 +1,4 @@ -ebola_response = TopicalEvent.find('ebola-government-response') +ebola_response = TopicalEvent.friendly.find('ebola-government-response') old_url = ebola_response.search_link ebola_response.remove_from_search_index