So I have two models linked together with a belongs_to and a
has_many. I wanted to only show values which were created by the
owner within a drop down. I was able to do this by changing
view_permitted?(field) as follows:
def view_permitted?(field)
acting_user.administrator? || user_is?(acting_user)
end
This effectively locked down the drop down values to only those which
were created by the user instead of including other users. This works
without issues.
So then I created two models which are linked by a has_many to
has_many relationship through an *_assignment table but it doesn't let
me limit the values to only those assignments created by the user. I
have to set the view permissions for both models to the following or I
get permission errors:
def view_permitted?(field)
true
end
This then allows me to see values created by other users, including my
own. I have used the :accessible => true going both ways to the
*_assignment table.
Does anyone know how to limit values through the models to only those
created by the user when using an assignment table for a many-to-many
relationship?
--
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.