Just to add, other options tried include: return true if branch.view_permitted?(field) return true if branch.view_permitted?(self.branch.name) return true if branch.view_permitted?
etc etc, the error returned is generally: 'undefined method `administrator?' for nil:NilClass', relating to the 'return true if acting_user.administrator?' line within the branch function. Much appreciated if someone can show me where I'm going wrong with this. Thanks, Paul On May 24, 3:27 pm, paulo <[email protected]> wrote: > Hi folks, > > Hopefully this is just me being daft, but have been struggling to > chain permission checks through models. > I have a 'branch' model which has_many 'contacts'. > > I have a block of code within my branch 'view_permitted?' function > which works fine, but I now would like to limit my contacts, based on > if the user has access to their branch. > > I figure that this should be pretty easy, so far i've tried various > versions of the following in my view_permitted? function in the > contacts model: > > def view_permitted?(field) > return true if branch.view_permitted?('name') > false > end > > -- > 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 > athttp://groups.google.com/group/hobousers?hl=en. -- 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.
