mirror of
https://github.com/projekteuler/projekteuler.git
synced 2025-12-10 08:46:41 +01:00
Fix association from problem to its current translation
This commit is contained in:
parent
d2f1292724
commit
5b7fd1fe27
@ -1,5 +1,6 @@
|
|||||||
class Problem < ActiveRecord::Base
|
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
|
delegate :title, :content, to: :translation
|
||||||
|
|
||||||
has_many :translations, inverse_of: :problem
|
has_many :translations, inverse_of: :problem
|
||||||
|
|||||||
4
test/fixtures/problems.yml
vendored
4
test/fixtures/problems.yml
vendored
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
one:
|
one:
|
||||||
id: 1
|
id: 1
|
||||||
translation_id: <%= ActiveRecord::FixtureSet.identify(:translation_one) %>
|
translation: translation_one
|
||||||
|
|
||||||
two:
|
two:
|
||||||
id: 2
|
id: 2
|
||||||
translation_id: <%= ActiveRecord::FixtureSet.identify(:translation_two) %>
|
translation: translation_two
|
||||||
|
|
||||||
three:
|
three:
|
||||||
id: 3
|
id: 3
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user