Rails 3.1.3

Say, I have tables, Video and Script.  Their association is

Video:1 --- n:Script

Also, Script has a field called 'value', (which is decimal, but the type
is not important here).

I want every 'value' to be unique for EACH Video. In other words,

Video1 : script-value=1, script-value=2, script-value=4 ...

is OK. But NOT

Video1 : script-value=2, script-value=2, script-value=4 ...


If I set ':value, uniqueness => true' in Script.rb, a critical problem
occurs.
script-value s are unique for EACH Video, but they are not for all
Videos.

Video1 : script-value:1, script-value:2, script-value:4 ...
Video2 : script-value:1, script-value:7, script-value:9 ...
...

Video1 and Video2 has the same script-values (=1), from which
'uniqueness => true' setting prevents.

Is there anyway to allow Videos to have the same 'value's, which however
are distinct from each other among the values that a single Video
possesses?


soichi

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to