私は解決できないという問題があります。問題は1つのユーザーモデルと1つのイベントモデルがあり、イベントモデルではユーザーが複数の役割を持つことができることです。また、アテンダントを既存のユーザとして追加することも、偽のユーザを作成することもできます(db内のフラグだけで)、実際のユーザに変換できます。Rails 3、has_many throughと多態性、または何か他のものを使用していますか?
So the diffrent user-type are:
A existing user who has created the event (this is a one-to-one relationship)
A existing user who is admin for the event
A existing user who has paid money on the event
A existing user who attended the event
and lastly a person who attended the event but isn't a user yet but has to be shown, so a fake-user would do here..
私は、ネストされたフォームを使用して参加するユーザー/偽のユーザーを追加します。
だから誰もこれを解決するためのアイデアを持っていますか? 私はhabtm、has_manyを試してきました。多型性とSTIを使用していますが、運はありません。 ありがとうございます!
これは私のネストされたフォームと少し複雑です、どうすればその問題を解決できますか? (私はまだユーザーではない出席者にネストされたフォームを使用します) – jonepatr
は、イベントをネストされた属性をユーザーに受け入れるようにしました。その鍵はイベント[user_attributes] [] [is_admin?]など – sethvargo
ですが、is_adminですか? user_attribute?それはusers_events_attributeですか? – jonepatr