transcribable 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,7 +26,7 @@ class TranscribableGenerator < ActiveRecord::Generators::Base
26
26
 
27
27
  def copy_files
28
28
  # Copies the migration template to db/migrate.
29
- if Transcribable.new_columns.length > 0
29
+ if Transcribable.new_columns && Transcribable.new_columns.length > 0
30
30
  @migration_name = "add_#{Transcribable.new_columns.keys.join("_and_")}_to_transcriptions"
31
31
  migration_template 'migration_add_columns.rb', "db/migrate/#{@migration_name}.rb"
32
32
  elsif !ActiveRecord::Base.connection.tables.include?("transcriptions")
@@ -42,7 +42,6 @@ class TranscribableGenerator < ActiveRecord::Generators::Base
42
42
  # views
43
43
  template 'views/layouts/simple_frame.html.erb', 'app/views/layouts/simple_frame.html.erb'
44
44
  template 'views/_form.html.erb', 'app/views/transcriptions/_form.html.erb'
45
- template 'views/edit.html.erb', 'app/views/transcriptions/edit.html.erb'
46
45
  template 'views/new.html.erb', 'app/views/transcriptions/new.html.erb'
47
46
 
48
47
  # assets
@@ -30,7 +30,7 @@ module Transcribable
30
30
  klass.column_names.each do |col|
31
31
  if klass.transcribable?(col)
32
32
  @@table = table
33
- @@transcribable_attrs[col] = @@table.classify.columns_hash[col].type
33
+ @@transcribable_attrs[col] = klass.columns_hash[col].type
34
34
  end
35
35
  end
36
36
  end
@@ -42,6 +42,8 @@ module Transcribable
42
42
  # and need transcriptions to catch up.
43
43
  # Returns a hash like transcribable_attrs
44
44
  def self.new_columns
45
+ return nil unless defined?(Transcription)
46
+
45
47
  cols = Transcribable.transcribable_attrs.keys - Transcription.columns_hash.keys
46
48
  cols.reduce(Hash.new(0)) do |memo, it|
47
49
  memo[it] = Kernel.const_get(@@table.classify).columns_hash[it].type
@@ -1,3 +1,3 @@
1
1
  module Transcribable
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transcribable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: