On 18 February 2013 10:37, Linus Pettersson <linus.pettersson@gmail.com> wrote:
> Also, about the relationship with company. If Entry is not related to
> Company, how do you deal with:
>
> 1. A user is deleted (the company may still want to see her Entries?)
Don't actually delete the user while she still has entries. Just mark
her as inactive or whatever is appropriate. If the entries are still
of interest then it may be of interest who created the entry even if
she has gone.
>
> 2. Isn't it inefficient to get all Entries from a company?
> company.users.each do ....
>
> Instead of just:
> company.entries
Company
has_many :users
has_many :entries, :through => :users
Then you can say @company.entries
Colin
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment