If you're going to have a collection, usually you preload the
collection and filter out what you don't want to reduce memory
overhead for one and to ensure accurate pagination for two.  If those
aren't a concern, add an if condition on the row checking for
permission will just not display those items for which permission is
lacking.

For example:
<table>
  <tr: if="&this.view_permitted?(field)" />
</table>

Though, most times at least one of the first two conditions I
mentioned applies so you filter what you load.

I actually tried mostly the same thing before tom pointed that out to
me about the pagination.

On Jan 29, 6:54 pm, "[email protected]" <[email protected]>
wrote:
> I am running into a problem on edge hobo where the table/table-plus
> tags are trying to render rows for every item in the collection
> regardless of whether or not the current user has permissions to view
> it. Along with that, if the current user does not have permission to
> view the item it will try to render a row but will run into errors
> when trying to display the individual fields for the item for all
> fields besides 'this'.
>
> Here is a simple app to recreate the problem:
>
> 1. Create an edge hobo app
> 2. Create a post model with a title:string and is_private:boolean
> 3. add belongs_to :user on the post model
> 4. add has_many :posts to the user model
> 5. change view_permitted? of post to be - !is_private || owner_is?
> (acting_user) || acting_user.administrator?
> 6. migrate everything
> 7. create some posts, some of the as with is private checked and
> others not
> 8. create post/index.dryml and put this in it
>
> <index-page>
>   <collection: replace>
>     <table without-header fields="this, draft, created_at" />
>   </collection:>
> </index-page>
>
> 9. View the index of posts as a guest and you should start seeing
> errors
>
> Any ideas on this? Any one else having this problem?
>
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to