Ah, ok. That did it. I see now I would want to limit the scope to the 
post_id column, instead of the post table.

Thank you!

Rob Biedenharn wrote:
> On Aug 19, 2010, at 11:23 AM, Ze Ca wrote:
> 
>>
>> I'm having a hard time limiting the scope of new comments to the Post
>> model. So, for validates_uniqueness_of :title in the comment.rb model,
>> that uniqueness would only be attached to the post I'm commenting to,
>> not globally among all comments in the application.
>>
>> I tried putting this in comment.rb:
>>
>> validates_uniqueness_of :title, :scope => :post
> 
> :scope => :post_id
> 
>>  CACHE (0.0ms)   SELECT * FROM "posts" WHERE ("posts"."id" = 5)
>> Rendered rescues/_request_and_response (1.2ms)
>> .
>> For more options, visit this group at 
>> http://groups.google.com/group/rubyonrails-talk?hl=en 
>> .
>>
> 
> Rob Biedenharn
> r...@agileconsultingllc.com  http://AgileConsultingLLC.com/
> r...@gaslightsoftware.com    http://GaslightSoftware.com/

-- 
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-t...@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