Fix rubocop warning
This commit is contained in:
parent
5e8fd6e6cb
commit
5bb21188e4
2 changed files with 9 additions and 13 deletions
|
@ -100,13 +100,6 @@ Naming/PredicateName:
|
||||||
- 'app/models/user.rb'
|
- 'app/models/user.rb'
|
||||||
- 'lib/classic_pagination/pagination.rb'
|
- 'lib/classic_pagination/pagination.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: Include.
|
|
||||||
# Include: app/models/**/*.rb
|
|
||||||
Rails/ActiveRecordOverride:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/trace.rb'
|
|
||||||
|
|
||||||
# Offense count: 6
|
# Offense count: 6
|
||||||
# Configuration parameters: Database, Include.
|
# Configuration parameters: Database, Include.
|
||||||
# SupportedDatabases: mysql, postgresql
|
# SupportedDatabases: mysql, postgresql
|
||||||
|
|
|
@ -43,12 +43,7 @@ class Trace < ActiveRecord::Base
|
||||||
validates :timestamp, :presence => true
|
validates :timestamp, :presence => true
|
||||||
validates :visibility, :inclusion => %w[private public trackable identifiable]
|
validates :visibility, :inclusion => %w[private public trackable identifiable]
|
||||||
|
|
||||||
def destroy
|
after_destroy :remove_files
|
||||||
super
|
|
||||||
FileUtils.rm_f(trace_name)
|
|
||||||
FileUtils.rm_f(icon_picture_name)
|
|
||||||
FileUtils.rm_f(large_picture_name)
|
|
||||||
end
|
|
||||||
|
|
||||||
def tagstring
|
def tagstring
|
||||||
tags.collect(&:tag).join(", ")
|
tags.collect(&:tag).join(", ")
|
||||||
|
@ -343,4 +338,12 @@ class Trace < ActiveRecord::Base
|
||||||
|
|
||||||
gpx
|
gpx
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def remove_files
|
||||||
|
FileUtils.rm_f(trace_name)
|
||||||
|
FileUtils.rm_f(icon_picture_name)
|
||||||
|
FileUtils.rm_f(large_picture_name)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue