From 5b7fd1fe270608f435e5b5ca7af353cb84b3ebe7 Mon Sep 17 00:00:00 2001 From: Philipp Fischbeck Date: Tue, 30 Dec 2014 23:32:17 +0100 Subject: [PATCH] Fix association from problem to its current translation --- app/models/problem.rb | 3 ++- test/fixtures/problems.yml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/models/problem.rb b/app/models/problem.rb index 4652b51..7747ddd 100644 --- a/app/models/problem.rb +++ b/app/models/problem.rb @@ -1,5 +1,6 @@ class Problem < ActiveRecord::Base - has_one :translation + # TODO Check whether there is a better relation for this + belongs_to :translation delegate :title, :content, to: :translation has_many :translations, inverse_of: :problem diff --git a/test/fixtures/problems.yml b/test/fixtures/problems.yml index 95b9482..48dcf94 100644 --- a/test/fixtures/problems.yml +++ b/test/fixtures/problems.yml @@ -2,11 +2,11 @@ one: id: 1 - translation_id: <%= ActiveRecord::FixtureSet.identify(:translation_one) %> + translation: translation_one two: id: 2 - translation_id: <%= ActiveRecord::FixtureSet.identify(:translation_two) %> + translation: translation_two three: id: 3