acts_as_translatable 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -24,21 +24,9 @@ class <%= migration_class_name %> < ActiveRecord::Migration
24
24
  # delete translated columns<% columns.each do |column| %>
25
25
  remove_column :<%= translatable_table %>, :<%= column %>
26
26
  <% end %>
27
-
28
- # insert acts_as_translatable_on in model
29
- model_file_path = "app/models/<%= model_name %>.rb"
30
- old_contents = File.open(model_file_path).read
31
- new_contents = old_contents.gsub("class <%= translatable_class %> < ActiveRecord::Base\n", "class <%= translatable_class %> < ActiveRecord::Base\n acts_as_translatable_on <%= columns.map { |c| ":#{c}" }.join(", ") %>\n\n")
32
- File.open(model_file_path, 'w') { |f| f.write new_contents }
33
27
  end
34
28
 
35
29
  def self.down
36
- # remove acts_as_translatable_on from model
37
- model_file_path = "app/models/<%= model_name %>.rb"
38
- old_contents = File.open(model_file_path).read
39
- new_contents = old_contents.gsub(" acts_as_translatable_on <%= columns.map { |c| ":#{c}" }.join(", ") %>\n", "")
40
- File.open(model_file_path, 'w') { |f| f.write new_contents }
41
-
42
30
  # re-add deleted columns
43
31
  # TODO: make sure that re-added columns are the same type as the original, if possible<% columns.each do |column| %>
44
32
  add_column :<%= translatable_table %>, :<%= column %>, :text
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_translatable
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Lasse Bunk