Skip to content

Commit

Permalink
allow show to be via name for genera and families as well
Browse files Browse the repository at this point in the history
  • Loading branch information
one-m1nd committed Mar 6, 2024
1 parent c6d4516 commit 1e78936
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/controllers/families_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def destroy
private
# Use callbacks to share common setup or constraints between actions.
def set_family
@family = Family.find(params[:id])
@family = Family.find_by(name: params[:id])
@family ||= Family.find(params[:id])
end

# Only allow a list of trusted parameters through.
Expand Down
3 changes: 2 additions & 1 deletion app/controllers/genera_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ def destroy
private
# Use callbacks to share common setup or constraints between actions.
def set_genus
@genus = Genus.find(params[:id])
@genus = Genus.find_by(name: params[:id])
@genus ||= Genus.find(params[:id])
end

# Only allow a list of trusted parameters through.
Expand Down

0 comments on commit 1e78936

Please sign in to comment.