私は Ruby on Rails を初めて使用し、特定の組織からスコアにアクセスしようとしています。誰かがこれを達成できる正しい方向に私を向けることができるかどうか疑問に思っていました. 現在、次のモデルがあります。
ユーザーモデルはこちら
class User < ActiveRecord::Base
attr_accessible :fname, :lname, :email, :password, :password_confirmation
has_secure_password
belongs_to :organization
組織モデルはこちら
class Organization < ActiveRecord::Base
attr_accessible :name, :employee_number, :country, :postal_code, :sic_code, :primary_url
has_many :users
has_many :social_entities
has_many :social_scores, :through => :social_entity
has_many :social_channels, :through => :social_entity
これがエンティティモデルです
class SocialEntity < ActiveRecord::Base
attr_accessible :name, :org_id
has_many :social_channels
has_many :social_scores
belongs_to :organization
チャンネルモデルはこちら
class SocialChannel < ActiveRecord::Base
attr_accessible :authorized, :channel_identifier, :channel_type, :name, :social_entity_id
belongs_to :social_entity # edited from original post, :socialentity
スコアモデルはこちら
class SocialScore < ActiveRecord::Base
attr_accessible :engagement_score, :popularity_score, :presence_score, :reputation_score, :score_period_end, :score_period_start, :score_period_type, :score_timestamp, :social_entity
belongs_to :social_entity
これが私がやろうとしていることの説明です。ユーザーはシステムにログインし、ユーザーは組織に関連付けられ、各組織にはソーシャル チャネルとスコアを持つソーシャル エンティティがあります。組織のスコアをビューに表示できるようにしたいと考えています。