From 38f4b3d7d7083a2db5e7d4b198ddfa4b9102125b Mon Sep 17 00:00:00 2001 From: toby cabot Date: Thu, 15 Aug 2013 14:39:04 -0400 Subject: [PATCH] refactor call to find(:first) to quiet deprecation warnings DEPRECATION WARNING: Calling #find(:first) is deprecated. Please call #first directly instead. (called from edit at ~/surveyor/lib/surveyor/surveyor_controller_methods.rb:63) Refactored so that we call either first() or find() depending on whether we've got a primary key or not. --- lib/surveyor/surveyor_controller_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/surveyor/surveyor_controller_methods.rb b/lib/surveyor/surveyor_controller_methods.rb index 35c40a89..28aeba18 100644 --- a/lib/surveyor/surveyor_controller_methods.rb +++ b/lib/surveyor/surveyor_controller_methods.rb @@ -60,7 +60,7 @@ def edit if @response_set @survey = Survey.with_sections.find_by_id(@response_set.survey_id) @sections = @survey.sections - @section = @sections.with_includes.find(section_id_from(params) || :first) || @sections.with_includes.first + @section = section_id_from(params) ? @sections.with_includes.find(section_id_from(params)) : @sections.with_includes.first set_dependents else flash[:notice] = t('surveyor.unable_to_find_your_responses')