Skip to content

Commit

Permalink
refactor call to find(:first) to quiet deprecation warnings
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
toby cabot committed Aug 15, 2013
1 parent b59ecfd commit 38f4b3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/surveyor/surveyor_controller_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 38f4b3d

Please sign in to comment.