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 --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Oct 7, 12:50 am, elioncho <elion...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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, > > ElionchoI''d drop the before_filter for the create action, since you''re already doing validations on the model side. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ll take your approach then. I''ll make a validate_con_create method on the wall_comment model. Thanks, Elioncho --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I''ll take your approach then. I''ll make a validate_con_create method on the wall_comment model. Thanks, Elioncho --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---