Question about validations


#1

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


#2

On Oct 7, 12:50 am, elioncho 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.


#3

I’ll take your approach then. I’ll make a validate_con_create method
on the wall_comment model. Thanks,

Elioncho


#4

I’ll take your approach then. I’ll make a validate_con_create method
on the wall_comment model. Thanks,

Elioncho