Hi, if you are using current version of activescaffold I would recommend to also take a look at using named scopes:
http://wiki.github.com/activescaffold/active_scaffold/api-list def named_scopes_for_collection end -- Volker On 1 Feb., 20:29, Brian Cardarella <[email protected]> wrote: > @kenny, > > Awesome, that worked. Thanks! > > On Feb 1, 12:51 pm, Kenny Ortmann <[email protected]> wrote: > > > *****If AS depends upon my route then it might be useless for what I'm doing > > AS does not depend on your route... It tries to do nice things for you > > depending on your route, but it doesn't have to do those things. > > > Inside of your controller you can specify the conditions for the records... > > > def conditions_for_collection > > end > > > There is an example > > herehttp://wiki.github.com/activescaffold/active_scaffold/api-list > > > The way AS is written you can override almost anything that you want so you > > should be able to do all of the admin stuff you want using it. It might be > > frustrating at first but once you have it figured out for one controller you > > will know how to do it for the rest. > > > ~Kenny > > On Mon, Feb 1, 2010 at 11:39 AM, Brian Cardarella > > <[email protected]>wrote: > > > > Ah, useless is not the best choice of words. I like AS for doing full > > > Admin stuff but limiting the scope of the retrievable records has been > > > frustrating. > > > > On Feb 1, 12:34 pm, Brian Cardarella <[email protected]> wrote: > > > > @kenny > > > > > Well, the point is to limit access to a company's set of users for > > > > the company admin. This is a trivial thing in Rails and I'm not > > > > certain why it has to be so difficult to do in ActiveScaffold. > > > > > If AS depends upon my route then it might be useless for what I'm > > > > doing. > > > > > - Brian > > > > > On Feb 1, 12:24 pm, Kenny Ortmann <[email protected]> wrote: > > > > > > Well it depends... Active scaffold does some nice things for you out > > > > > of > > > the > > > > > box... > > > > > for instance > > > > > > If you are on they users - partners page, > > > > > > url/users/5/partners > > > > > > and you have active scaffold configured for the partners controller, > > > > > it > > > will > > > > > try to load only that users partners. > > > > > > But if the out of the box stuff does not work the way you want it to > > > you can > > > > > define this method in your controller > > > > > > protected > > > > > def conditions_for_collection > > > > > conditions = {:partner_id => current_user.id > > > > > end > > > > > > Your situation is a little different because you have a has_many > > > :through > > > > > relationship so you might have to tweak the conditions but you can get > > > this > > > > > to work. > > > > > > On Mon, Feb 1, 2010 at 11:13 AM, Brian Cardarella < > > > [email protected]>wrote: > > > > > > > So I'm trying to replace some Admin stuff with ActiveScaffold. For > > > > > > example, I have this in a particular controller: > > > > > > > def index > > > > > > @users = current_user.partner.users > > > > > > end > > > > > > > def show > > > > > > @user = current_user.partner.users.find(params[:id]) > > > > > > end > > > > > > > Is there a way to replicate this behavior in AS? Everything I've > > > > > > read > > > > > > points to no, that it will take into consideration all records > > > instead > > > > > > of a specific portion of records. Thoughts? > > > > > > > - Brian > > > > > > > -- > > > > > > You received this message because you are subscribed to the Google > > > Groups > > > > > > "ActiveScaffold : Ruby on Rails plugin" group. > > > > > > To post to this group, send email to [email protected] > > > . > > > > > > To unsubscribe from this group, send email to > > > > > > [email protected]<activescaffold%2bunsubscr...@go > > > > > > oglegroups.com> > > > <activescaffold%2bunsubscr...@go oglegroups.com> > > > > > > . > > > > > > For more options, visit this group at > > > > > >http://groups.google.com/group/activescaffold?hl=en. > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "ActiveScaffold : Ruby on Rails plugin" group. > > > To post to this group, send email to [email protected]. > > > To unsubscribe from this group, send email to > > > [email protected]<activescaffold%2bunsubscr...@go > > > oglegroups.com> > > > . > > > For more options, visit this group at > > >http://groups.google.com/group/activescaffold?hl=en. -- You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.
