CMS 응용 프로그램에서 2 가지 모델간에 일대 다 관계를 맺으려고합니다. 상황은 다음과 같습니다.두 모델 간의 다중 연관 - 레일즈 3
class User < ActiveRecord::Base
has_many :mycontent, :class_name => "Content", :as => "owner"
has_many :content_users
has_many :contents, :through => :content_users
end
class Content < ActiveRecord::Base
has_attached_file :attachment
belongs_to :owner, :class_name => "User"
has_many :content_users
has_many :users, :through => :content_users
end
에 대한 :
- 소유자 (사용자) 많은 내용을 가지고, 내용이
- 사용자가 내용이 많은 사용자
내 모델을 많은 내용을 가지고있는 소유자를 다음과 같이되어있다 이것이 나를 위해 올바르게 작동하지 않는 몇 가지 이유. 도와주세요. 감사합니다.
를 사용해야합니까? – bassneck