That is really great, thanks so much! It makes no sense whatsoever to
me since I don't know about scopes, but I can see that this has a lot
of potential.

On Oct 21, 1:28 pm, vhochstein <[email protected]> wrote:
> Hi Mike,
>
> You may try the following in Rails 3:
> remove your association in your model.
>
> class Member < ActiveRecord::Base
>   scope :family_scope, lambda {|family_id| where({:family_id =>
> family_id})}
>   def family
>     self.class.family_scope(self.family_id)
>   end
> end
>
> class MembersController < ApplicationController
>   active_scaffold :member do |conf|
>     conf.list.columns = [:name, :family_id]
>     conf.create.columns = [:name, :family_id]
>     conf.update.columns = [:name, :family_id]
>     conf.nested.add_scoped_link(:family)
>   end
> end
>
> --
> Volker
>
> On 20 Okt., 22:01, MikeBlyth <[email protected]> wrote:
>
> > I have a model like this:
> >     class Member < ActiveRecord::Base
> >         belongs_to :family, :class_name => "Member", :foreign_key =>
> > "family_id"
> >     ...
> > In other words, each member includes a family_id that links a group of
> > members together as a family (but there are not "family" objects, only
> > members). I would like to be able to click on the family field in the
> > members listing, and open a sub-list consisting of all members with
> > the same family_id. Since there is actually no family model where I
> > can put "has_many," I'm not sure how to do this. Another alternative
> > would be that clicking on the family_id of a member reloads the page
> > but filtering for that family member. I can do this outside
> > ActiveScaffold, but is there a way to use ActiveScaffold for the task?

-- 
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.

Reply via email to