dm-aux_codes 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/aux_codes.rb +5 -1
  2. metadata +1 -1
@@ -21,7 +21,7 @@ module Stuff
21
21
 
22
22
  # timestamps :at
23
23
 
24
- belongs_to :aux_code, :required => false
24
+ belongs_to :aux_code
25
25
  has n, :aux_codes
26
26
 
27
27
  def self.name
@@ -208,6 +208,10 @@ module Stuff
208
208
  # initialize AuxCodes ... looks for config/aux_codes.yml
209
209
  # and creates classes
210
210
  def init # should eventually take configuration options (hash || block)
211
+ # If there isn't an AuxCode yet, make one with the ID of 0.
212
+ # This makes database foreign key constraints stop complaining
213
+ # when we create aux codes where the aux_code_id is 0.
214
+ AuxCode.create :id => 0, :name => 'Aux Code Categories' if AuxCode.count == 0
211
215
  aux_codes_yml = File.join 'config', 'aux_codes.yml'
212
216
  if File.file? aux_codes_yml
213
217
  load_file aux_codes_yml
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dm-aux_codes
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - remi