Search Results

Search found 3 results on 1 pages for 'vijendra'.

Page 1/1 | 1 

  • has_many relation doesn't seems right or logical, some thing like belongs_to_many looks right

    - by Vijendra
    My situation is like this. Company has many users and users may belongs to many companies. And current implementation is something like below. class Company has_many :employments has_many :users, :through = :employments end class Employment belongs_to :company belongs_to :user end class User has_many :employments has_many :companies, :through = :employments #This doesn't looks correct end User has many companies doesn't looks logically meaningful.It must be some thing like belongs_to_many companies. Do I need to use has_and_belongs_to_many? But that also will gives the same meaning. Can some one please suggest the right way for representing these relationships?

    Read the article

  • has_many relation doesn't seems right or logical in business perceptive, needed some thing like belo

    - by Vijendra
    My situation is like this. Company has many users and users may belongs to many companies. And current implementation is something like below. class Company has_many :employments has_many :users, :through = :employments end class Employment belongs_to :company belongs_to :user end class User has_many :employments has_many :companies, :through = :employments #This doesn't looks correct end It works, but "user has many companies" doesn't looks logically meaningful. It must be some thing like belongs_to_many companies. Do I need to use has_and_belongs_to_many? Can some one please suggest the right way for representing these relationships?

    Read the article

  • How to fix the size of the Hashtable and find the whether it has fix size or not?

    - by Vijjendra
    Hi All, I am trying to fix the size of the Hashtable with following code. Hashtable hashtable = new Hashtable(2); //Add elements in the Hashtable hashtable.Add("A", "Vijendra"); hashtable.Add("B", "Singh"); hashtable.Add("C", "Shakya"); hashtable.Add("D", "Delhi"); hashtable.Add("E", "Singh"); hashtable.Add("F", "Shakya"); hashtable.Add("G", "Delhi"); hashtable.Add("H", "Singh"); hashtable.Add("I", "Shakya"); hashtable.Add("J", "Delhi"); I have fix the size of this Hashtable is 2 but I can add more than 2 elements in this, why this happen, I am doing somthing wrong? I have tried to find out is this Hashtable have fix size of not with hashtable.IsFixedSize, it always returns false Please tell me where I am wrong, or there is another way..

    Read the article

1