diff --git a/app/models/frage.rb b/app/models/frage.rb
index 8a47df4..0d26178 100644
--- a/app/models/frage.rb
+++ b/app/models/frage.rb
@@ -1,10 +1,9 @@
class Frage < ActiveRecord::Base
- has_paper_trail
attr_accessible :text, :title
belongs_to :thema
validates :thema, :presence => true
- validates :title, :prescece => true
+ validates :title, :presence => true
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end
diff --git a/app/models/frage.rb~ b/app/models/frage.rb~
index 27bc8c4..630e3b8 100644
--- a/app/models/frage.rb~
+++ b/app/models/frage.rb~
@@ -1,3 +1,10 @@
class Frage < ActiveRecord::Base
+ has_paper_trail
attr_accessible :text, :title
+ belongs_to :thema
+
+ validates :thema, :presence => true
+ validates :title, :presence => true
+
+ translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end
diff --git a/app/models/thema.rb b/app/models/thema.rb
index 71edf91..44be678 100644
--- a/app/models/thema.rb
+++ b/app/models/thema.rb
@@ -1,10 +1,11 @@
class Thema < ActiveRecord::Base
- has_paper_trail
attr_accessible :text, :title
has_many :fragen
has_many :attachments
- belongs_to :themengruppe
+ belongs_to :themengruppe, :foreign_key => "themengruppe_id"
validates :themengruppe, :presence => true
validates :title, :presence => true
+
+ translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end
diff --git a/app/models/thema.rb~ b/app/models/thema.rb~
index fd3bc93..9167351 100644
--- a/app/models/thema.rb~
+++ b/app/models/thema.rb~
@@ -1,5 +1,11 @@
class Thema < ActiveRecord::Base
attr_accessible :text, :title
has_many :fragen
+ has_many :attachments
belongs_to :themengruppe
+
+ validates :themengruppe, :presence => true
+ validates :title, :presence => true
+
+ translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end
diff --git a/app/models/themengruppe.rb b/app/models/themengruppe.rb
index 95cf797..f73289d 100644
--- a/app/models/themengruppe.rb
+++ b/app/models/themengruppe.rb
@@ -1,8 +1,9 @@
class Themengruppe < ActiveRecord::Base
- has_paper_trail
attr_accessible :text, :title
has_many :themen
has_many :fragen, through: :themen
validates :title, :presence => true
+
+ translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end
diff --git a/app/models/themengruppe.rb~ b/app/models/themengruppe.rb~
index c96a7c5..95cf797 100644
--- a/app/models/themengruppe.rb~
+++ b/app/models/themengruppe.rb~
@@ -1,3 +1,8 @@
class Themengruppe < ActiveRecord::Base
+ has_paper_trail
attr_accessible :text, :title
+ has_many :themen
+ has_many :fragen, through: :themen
+
+ validates :title, :presence => true
end
diff --git a/app/views/fragen/show.html.erb b/app/views/fragen/show.html.erb
index 4718b83..64cd962 100644
--- a/app/views/fragen/show.html.erb
+++ b/app/views/fragen/show.html.erb
@@ -1,12 +1,10 @@
<%= notice %>
-
- Title:
+
<%= @frage.title %>
-
+
- Text:
<%= @frage.text %>
diff --git a/app/views/fragen/show.html.erb~ b/app/views/fragen/show.html.erb~
new file mode 100644
index 0000000..4718b83
--- /dev/null
+++ b/app/views/fragen/show.html.erb~
@@ -0,0 +1,15 @@
+<%= notice %>
+
+
+ Title:
+ <%= @frage.title %>
+
+
+
+ Text:
+ <%= @frage.text %>
+
+
+
+<%= link_to 'Edit', edit_frage_path(@frage) %> |
+<%= link_to 'Back', fragen_path %>
diff --git a/app/views/themengruppen/index.html.erb b/app/views/themengruppen/index.html.erb
index f4655e1..6cd7fe6 100644
--- a/app/views/themengruppen/index.html.erb
+++ b/app/views/themengruppen/index.html.erb
@@ -9,17 +9,17 @@
|
-<% @themengruppen.each do |themagruppen| %>
+<% @themengruppen.each do |themengruppe| %>
- | <%= themagruppen.title %> |
- <%= themagruppen.text %> |
- <%= link_to 'Show', themagruppen %> |
- <%= link_to 'Edit', edit_themagruppen_path(themagruppen) %> |
- <%= link_to 'Destroy', themagruppen, method: :delete, data: { confirm: 'Are you sure?' } %> |
+ <%= themengruppe.title %> |
+ <%= themengruppe.text %> |
+ <%= link_to 'Show', themengruppe %> |
+ <%= link_to 'Edit', edit_themengruppe_path(themengruppe) %> |
+ <%= link_to 'Destroy', themengruppe, method: :delete, data: { confirm: 'Are you sure?' } %> |
<% end %>
-<%= link_to 'New Themengruppe', new_themagruppen_path %>
+<%= link_to 'New Themengruppe', new_themengruppe_path %>
diff --git a/app/views/themengruppen/index.html.erb~ b/app/views/themengruppen/index.html.erb~
new file mode 100644
index 0000000..f4655e1
--- /dev/null
+++ b/app/views/themengruppen/index.html.erb~
@@ -0,0 +1,25 @@
+Listing themengruppen
+
+
+
+ | Title |
+ Text |
+ |
+ |
+ |
+
+
+<% @themengruppen.each do |themagruppen| %>
+
+ | <%= themagruppen.title %> |
+ <%= themagruppen.text %> |
+ <%= link_to 'Show', themagruppen %> |
+ <%= link_to 'Edit', edit_themagruppen_path(themagruppen) %> |
+ <%= link_to 'Destroy', themagruppen, method: :delete, data: { confirm: 'Are you sure?' } %> |
+
+<% end %>
+
+
+
+
+<%= link_to 'New Themengruppe', new_themagruppen_path %>
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index f8522e4..680a5bf 100755
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -27,8 +27,8 @@ inflect.plural 'beispiel', 'beispiele'
inflect.singular 'beispiele', 'beispiel'
inflect.plural 'themengruppe', 'themengruppen'
inflect.singular 'themengruppen', 'themengruppe'
-inflect.plural 'thema', 'themen'
-inflect.singular 'themen', 'thema'
+inflect.plural /thema$/, 'themen'
+inflect.singular /themen$/, 'thema'
inflect.plural 'frage', 'fragen'
inflect.singular 'fragen', 'frage'
end
diff --git a/config/initializers/inflections.rb~ b/config/initializers/inflections.rb~
index da3eb47..8bb31db 100755
--- a/config/initializers/inflections.rb~
+++ b/config/initializers/inflections.rb~
@@ -27,9 +27,8 @@ inflect.plural 'beispiel', 'beispiele'
inflect.singular 'beispiele', 'beispiel'
inflect.plural 'themengruppe', 'themengruppen'
inflect.singular 'themengruppen', 'themengruppe'
-inflect.plural 'thema', 'themen'
-inflect.singular 'themen', 'thema'
+inflect.plural /thema$/, 'themen'
+inflect.singular /^themen$/, 'thema'
inflect.plural 'frage', 'fragen'
inflect.singular 'fragen', 'frage'
-
end
diff --git a/db/migrate/20130805170517_add_id_to_themen.rb b/db/migrate/20130805170517_add_id_to_themen.rb
new file mode 100644
index 0000000..b6799ae
--- /dev/null
+++ b/db/migrate/20130805170517_add_id_to_themen.rb
@@ -0,0 +1,7 @@
+class AddIdToThemen < ActiveRecord::Migration
+ def change
+ add_column :themen, :themengruppe_id, :integer
+ add_column :attachments, :thema_id, :integer
+ add_column :fragen, :thema_id, :integer
+ end
+end
diff --git a/db/migrate/20130805170517_add_id_to_themen.rb~ b/db/migrate/20130805170517_add_id_to_themen.rb~
new file mode 100644
index 0000000..b6799ae
--- /dev/null
+++ b/db/migrate/20130805170517_add_id_to_themen.rb~
@@ -0,0 +1,7 @@
+class AddIdToThemen < ActiveRecord::Migration
+ def change
+ add_column :themen, :themengruppe_id, :integer
+ add_column :attachments, :thema_id, :integer
+ add_column :fragen, :thema_id, :integer
+ end
+end
diff --git a/db/migrate/20130805171433_translate_themen.rb b/db/migrate/20130805171433_translate_themen.rb
new file mode 100644
index 0000000..6f5db97
--- /dev/null
+++ b/db/migrate/20130805171433_translate_themen.rb
@@ -0,0 +1,38 @@
+class TranslateThemen < ActiveRecord::Migration
+ def up
+ Thema.create_translation_table!({
+ :title => :string,
+ :text => :text
+ }, {
+ #:migrate_data => true
+ })
+ add_column :thema_translations, :themen_id, :integer
+ remove_column :thema_translations, :thema_id
+
+ Themengruppe.create_translation_table!({
+ :title => :string,
+ :text => :text
+ }, {
+ #:migrate_data => true
+ })
+ add_column :themengruppe_translations, :themengruppen_id, :integer
+ remove_column :themengruppe_translations, :themengruppe_id
+
+
+ Frage.create_translation_table!({
+ :title => :string,
+ :text => :text
+ }, {
+ #:migrate_data => true
+ })
+ add_column :frage_translations, :fragen_id, :integer
+ remove_column :frage_translations, :frage_id
+
+ end
+
+ def down
+ Thema.drop_translation_table! #:migrate_data => true
+ Themengruppe.drop_translation_table! #:migrate_data => true
+ Frage.drop_translation_table! #:migrate_data => true
+ end
+end
diff --git a/db/migrate/20130805171433_translate_themen.rb~ b/db/migrate/20130805171433_translate_themen.rb~
new file mode 100644
index 0000000..147fb02
--- /dev/null
+++ b/db/migrate/20130805171433_translate_themen.rb~
@@ -0,0 +1,38 @@
+class TranslateThemen < ActiveRecord::Migration
+ def up
+ Thema.create_translation_table!({
+ :title => :string,
+ :text => :text
+ }, {
+ #:migrate_data => true
+ })
+ add_column :thema_translations, :themen_id, :integer
+ remove_column :themagruppe_translations, :thema_id
+
+ Themengruppe.create_translation_table!({
+ :title => :string,
+ :text => :text
+ }, {
+ #:migrate_data => true
+ })
+ add_column :themengruppe_translations, :themengruppen_id, :integer
+ remove_column :themengruppe_translations, :themengruppe_id
+
+
+ Frage.create_translation_table!({
+ :title => :string,
+ :text => :text
+ }, {
+ #:migrate_data => true
+ })
+ add_column :frage_translations, :fragen_id, :integer
+ remove_column :frage_translations, :frage_id
+
+ end
+
+ def down
+ Thema.drop_translation_table! #:migrate_data => true
+ Themengruppe.drop_translation_table! #:migrate_data => true
+ Frage.drop_translation_table! #:migrate_data => true
+ end
+end