On 30 Oct, 18:05, Ashley Moran <[email protected]> wrote:
> On 30 Oct 2009, at 14:11, Andrew Threlfall wrote:
>
> > The usual method of daisy-chaining them in the controller like:
> > current_user.account.books.recipies.ingredients.etc...find(:id)
> > will have a big overhead if we only want to check if the user can
> > access a record such as ingredients.
>
> What's the business rule here that decides if a user can see an  
> ingredient?
The system needs to be able to do processing to see the ingredients
based on a subset of the recipes eg vegetarian ones.  So I essentially
want to see the ingredients in all the vegetarian recipes in all the
books in my account. In this instance the ingredients are all unique,
and not common for other recipes. Also if someone wants to view or
edit ingredient with id 20,000 how do I very quickly know if that one
of theirs?

The model names have been changed, but the analogy is more or the less
the same.

Technically it's possible with scoping, but more a case of wondering
if there is any good practice that will mean this can be done
efficiently. I don't want to be joining potentially hundreds of
thousands of rows, or adding permission methods to models, or adding
user or account ids to models further down the tree too early, but I
can see it becoming a problem very soon.

--
Andrew Threlfall

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NWRUG" 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/nwrug-members?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to