I need some help understanding how view_permitted? works with child records.
I have a parent record which has many child records. Whether users are only permitted to view the child records is dependent on an attribute of the parent record. The most straight forward way to implement this should be by implementing the view_permitted? permission in the child model. However this is proving to be more difficult than it should be - partly because I'm not understanding what is going on. When I display the child records view_permitted? gets called a number of times. I was expecting a call with field=nil at the beginning of each record and a call for each field with the field parameter set accordingly. This is what happens for the parent record. However, for the child records the first call to view_permitted? for each record has the field parameter set to the index number of the record in the set of child records (ie 0 to n). At the time of the first call, the child record model hasn't been populated which makes it very difficult to determine if the view should be permitted or not. Is this the correct behaviour, and if so, how do I get the model populated at the first call? Thanks, Dean -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
