# Question about validations

**URL:** <https://www.ruby-forum.com/t/question-about-validations/150269>\
**Category:** Rails\
**Created:** [October 6, 2008, 6:53pm UTC](https://www.ruby-forum.com/t/question-about-validations/150269 "2008-10-06T18:53:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [October 6, 2008, 6:53pm UTC](https://www.ruby-forum.com/t/question-about-validations/150269/1 "2008-10-06T18:53:14Z")

</div>

Hello,

Well I have implemented in my app a wall similar to the one found on  
facebooks user profiles. I have created a wall\_comments controller and  
wall\_comment model. Only friends can post in each others wall. On my  
views I check that if the current user is not friend of a particular  
user the form for posting a comments is not shown. On the  
wall\_comments controller I have a before\_filter for the create action  
that checks if the two users are friends. And on my wall\_comment model  
I have a validate\_on\_save method that checks again if the two users  
are friends again.

Is this a good practice? That much validations? More queries, slower  
response times? Any suggestions or is it ok like that?

Thanks,

Elioncho

---

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [October 6, 2008, 7:56pm UTC](https://www.ruby-forum.com/t/question-about-validations/150269/2 "2008-10-06T19:56:20Z")

</div>

On Oct 7, 12:50 am, elioncho [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> are friends again.
> 
> Is this a good practice? That much validations? More queries, slower  
> response times? Any suggestions or is it ok like that?
> 
> Thanks,
> 
> Elioncho

I’d drop the before\_filter for the create action, since you’re already  
doing validations on the model side.

---

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [October 6, 2008, 10:42pm UTC](https://www.ruby-forum.com/t/question-about-validations/150269/3 "2008-10-06T22:42:41Z")

</div>

I’ll take your approach then. I’ll make a validate\_con\_create method  
on the wall\_comment model. Thanks,

Elioncho

---

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [October 6, 2008, 11:06pm UTC](https://www.ruby-forum.com/t/question-about-validations/150269/4 "2008-10-06T23:06:46Z")

</div>

I’ll take your approach then. I’ll make a validate\_con\_create method  
on the wall\_comment model. Thanks,

Elioncho
