fix inflections

irregular sollte bei inflections genutzt werden
This commit is contained in:
Andreas Stephanides
2013-08-18 20:48:45 +02:00
parent 51f59bcd83
commit d17b911809
2 changed files with 60 additions and 4 deletions

View File

@@ -16,19 +16,22 @@
ActiveSupport::Inflector.inflections do |inflect|
inflect.plural 'studium', 'studien'
inflect.singular 'studien', 'studium'
inflect.plural 'neuigkeit', 'neuigkeiten'
inflect.singular 'neuigkeiten', 'neuigkeit'
inflect.irregular 'studium', 'studien'
inflect.irregular 'neuigkeit', 'neuigkeiten'
#inflect.irregular 'neuigkeiten', 'neuigkeit'
inflect.plural 'modulgruppe', 'modulgruppen'
inflect.singular 'modulgruppen', 'modulgruppe'
inflect.irregular 'modulgruppe', 'modulgruppen'
inflect.plural 'rubrik', 'rubriken'
inflect.singular 'rubriken', 'rubrik'
inflect.irregular 'rubrik', 'rubriken'
inflect.plural 'beispiel', 'beispiele'
inflect.singular 'beispiele', 'beispiel'
inflect.plural 'themengruppe', 'themengruppen'
inflect.singular 'themengruppen', 'themengruppe'
inflect.irregular 'themengruppe', 'themengruppen'
inflect.plural /thema$/, 'themen'
inflect.singular /themen$/, 'thema'
inflect.irregular 'thema', 'themen'
inflect.plural 'frage', 'fragen'
inflect.singular 'fragen', 'frage'
inflect.irregular 'frage', 'fragen'
end

View File

@@ -0,0 +1,53 @@
class FixTranslationTables < ActiveRecord::Migration
def up
Thema::Translation.reset_column_information
if (!Thema::Translation.column_names.include?('thema_id'))
add_column :thema_translations, :thema_id,:integer
Thema::Translation.all.each do |t|
t.thema_id=t.theman_id
t.save
end
end
Studium::Translation.reset_column_information
if (!Studium::Translation.column_names.include?('studium_id'))
add_column :studium_translations, :studium_id,:integer
Studium::Translation.all.each do |t|
t.studium_id=t.studien_id
t.save
end
end
Themengruppe::Translation.reset_column_information
if (!Themengruppe::Translation.column_names.include?('themengruppe_id'))
add_column :themengruppe_translations, :themengruppe_id,:integer
Themengruppe::Translation.all.each do |t|
t.themengruppe_id=t.themengruppen_id
t.save
end
end
Frage::Translation.reset_column_information
if (!Frage::Translation.column_names.include?('frage_id'))
add_column :frage_translations, :frage_id,:integer
Frage::Translation.all.each do |t|
t.frage_id=t.fragen_id
t.save
end
end
Neuigkeit::Translation.reset_column_information
if (!Neuigkeit::Translation.column_names.include?('neuigkeit_id'))
add_column :neuigkeit_translations, :neuigkeit_id,:integer
Neuigkeit::Translation.all.each do |t|
t.neuigkeit_id=t.neuigkeiten_id
t.save
end
end
end
def down
remove_column :studium_translations, :studium_id
remove_column :thema_translations, :thema_id
remove_column :themengruppe_translations, :themengruppe_id
remove_column :frage_translations, :frage_id
end
end