If you've got a MetaMapper object: object MyTable extends MyTable with MetaMapper[MyTable]
In your snippet:
MyTable.addlQueryParams.set(By(MyTable.user, User.currentUser))
Or, if you want to do it just as part of a call:
MyTable.addQueryParams.doWith(By(MyTable.user, User.currentUser)) {
... call in here
}
So, none of this is metaprogramming, it's just an API call.
On Wed, Jan 20, 2010 at 5:18 PM, Franz Bettag <[email protected]> wrote:
> Metaprogramming is still a bit new for me, so here is the question:
>
> What would be the cleanest way to implement a parameter-injection into
> find() and findAll()?
> The idea is to wrap catch every find() and findAll() and inject for
> example the User.currentUser's customerId.
>
> So it would be quite safe to .find() whatever the user requests, since
> it would only return records belonging to that customer. Since i
> already have a trait called Customerize which adds a customer
> MappedLongForeignKey to every extended class, i guess this would be
> the entry point to start dispatching.
>
> I tried to override findAll() but i basically wound up copying all
> code from MetaMapper.scala which wasn't really what i want.
>
> So if anyone has an idea of how to solve this, i'd love to hear it. :)
>
> best regards
>
> --
> You received this message because you are subscribed to the Google Groups
> "Lift" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<liftweb%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/liftweb?hl=en.
>
>
>
>
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Surf the harmonics
-- You received this message because you are subscribed to the Google Groups "Lift" 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/liftweb?hl=en.
