On Mon, Jul 14, 2014 at 6:07 AM, Ronald Fischer <li...@ruby-forum.com> wrote:
> I have 3 models, say A, B and C, and they are set up like this:
>
> A:
>   has_many :Bs
>   has_many :Cs, through: B

> In my model for C, I want to declare, that a column ccol within C must
> be unique, but only within the scope of a certain A.

> Is there a possibility to achieve this?

With a custom validation, you can theoretically do anything :-)

That said: consider that your expressed goal is a Law of Demeter
violation, and might be reason to rethink your models?

Hard to say more without understanding the actual domain...

FWIW,
-- 
Hassan Schroeder ------------------------ hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yB85Er1O%2B2WKAJd%2BNqJqKCgG5rg%2BLevWzWiYfbc%2B7k-dA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to