Is there a hoboesque way of making autocompleters obey my modes
view_permitted? methods? Say I have a bunch of poems that belong to
different users. Users can make their poems public or private by
checking an is_private field and users can add related poems to their
poem via an autocompleter on their poem's showpage that populates a
cross_reference model.
The problem is that the autocompleter gives the names of all of the
poems even if it is a poem they can not view. I don't want to do this
through scopes on the models is_private field because in the future
view permissions are going to get much more complex. Right now I
hacked line 675 of model_controller.rb from...
items = finder.find(:all)
to be...
items = finder.find(:all).delete_if { |item| !item.viewable_by?
(current_user) }
Is there a better way of doing this? Should autocompleters be view
permission aware be default?
Thanks,
Craig
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---