mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-26 12:08:47 +01:00
Use first_or_create to creating missing Tags
This commit is contained in:
parent
3425b3fa10
commit
1431bef1a9
1 changed files with 1 additions and 2 deletions
|
|
@ -724,8 +724,7 @@ class TodosController < ApplicationController
|
|||
@source_view = params['_source_view'] || 'tag'
|
||||
@tag_name = sanitize(params[:name]) # sanitize to prevent XSS vunerability!
|
||||
@page_title = t('todos.all_completed_tagged_page_title', :tag_name => @tag_name)
|
||||
@tag = Tag.where(:name => @tag_name).first
|
||||
@tag = Tag.new(:name => @tag_name) if @tag.nil?
|
||||
@tag = Tag.where(:name => @tag_name).first_or_create
|
||||
end
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue