1

我正在使用 Rails 中的 API 并碰壁。我错过了一些我想象的愚蠢的东西,但我看不到它。

https://gist.github.com/3989396

我无法获取 item.json 中传递的关联来创建关联。我认为 Rails 会连接这些。

4

1 回答 1

1

帐户的关系需要像这样固定:

项目.rb:

belongs_to :expense_account, class_name: "Account"
belongs_to :income_account, class_name: "Account"

帐户.rb:

has_many :items, inverse_of: :expense_account
has_many :items, inverse_of: :income_account
于 2012-10-31T20:48:31.007 回答