fixes hound

This commit is contained in:
zmagod 2017-06-28 15:29:10 +02:00
parent 525c9770ac
commit d8a3fdea20
3 changed files with 7 additions and 12 deletions

View file

@ -374,7 +374,7 @@ class MyModule < ApplicationRecord
x: self.x, x: self.x,
y: self.y) y: self.y)
clone.save clone.save
# Remove the automatically generated protocol, # Remove the automatically generated protocol,
# & clone the protocol instead # & clone the protocol instead
clone.protocol.destroy clone.protocol.destroy

View file

@ -11,13 +11,9 @@ class SampleMyModule < ApplicationRecord
foreign_key: 'assigned_by_id', foreign_key: 'assigned_by_id',
class_name: 'User', class_name: 'User',
optional: true optional: true
belongs_to :sample, belongs_to :sample, inverse_of: :sample_my_modules, optional: true
inverse_of: :sample_my_modules, belongs_to :my_module, inverse_of: :sample_my_modules, optional: true
optional: true
belongs_to :my_module,
inverse_of: :sample_my_modules,
optional: true
def increment_nr_of_module_samples def increment_nr_of_module_samples
my_module.increment!(:nr_of_assigned_samples) my_module.increment!(:nr_of_assigned_samples)
sample.increment!(:nr_of_modules_assigned_to) sample.increment!(:nr_of_modules_assigned_to)

View file

@ -1,11 +1,10 @@
class Token < ApplicationRecord class Token < ApplicationRecord
validates :token, presence: true validates :token, presence: true
validates :ttl, presence: true validates :ttl, presence: true
belongs_to :user, belongs_to :user,
foreign_key: 'user_id', foreign_key: 'user_id',
class_name: 'User', class_name: 'User',
inverse_of: :tokens, inverse_of: :tokens,
optional: true optional: true
end end