Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 Rails 中的 API 并碰壁。我错过了一些我想象的愚蠢的东西,但我看不到它。
https://gist.github.com/3989396
我无法获取 item.json 中传递的关联来创建关联。我认为 Rails 会连接这些。
帐户的关系需要像这样固定:
项目.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